mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-14 22:24:14 +00:00
runtime/clh: fix image/initrd annotation handling
We should make sure annotations are preferred over
config options in image and initrd path handling.
Fixes: #7705
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
(cherry picked from commit 9fda7059a5
)
Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
parent
59fae423b5
commit
f86bfe0da3
@ -549,14 +549,14 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
|
|||||||
clh.vmconfig.Rng.SetIommu(clh.config.IOMMU)
|
clh.vmconfig.Rng.SetIommu(clh.config.IOMMU)
|
||||||
|
|
||||||
// set the initial root/boot disk of hypervisor
|
// set the initial root/boot disk of hypervisor
|
||||||
imagePath, err := clh.config.ImageAssetPath()
|
assetPath, assetType, err := clh.config.ImageOrInitrdAssetPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if imagePath != "" {
|
if assetType == types.ImageAsset {
|
||||||
if clh.config.ConfidentialGuest {
|
if clh.config.ConfidentialGuest {
|
||||||
disk := chclient.NewDiskConfig(imagePath)
|
disk := chclient.NewDiskConfig(assetPath)
|
||||||
disk.SetReadonly(true)
|
disk.SetReadonly(true)
|
||||||
|
|
||||||
diskRateLimiterConfig := clh.getDiskRateLimiterConfig()
|
diskRateLimiterConfig := clh.getDiskRateLimiterConfig()
|
||||||
@ -570,7 +570,7 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
|
|||||||
clh.vmconfig.Disks = &[]chclient.DiskConfig{*disk}
|
clh.vmconfig.Disks = &[]chclient.DiskConfig{*disk}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pmem := chclient.NewPmemConfig(imagePath)
|
pmem := chclient.NewPmemConfig(assetPath)
|
||||||
*pmem.DiscardWrites = true
|
*pmem.DiscardWrites = true
|
||||||
pmem.SetIommu(clh.config.IOMMU)
|
pmem.SetIommu(clh.config.IOMMU)
|
||||||
|
|
||||||
@ -581,12 +581,8 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
initrdPath, err := clh.config.InitrdAssetPath()
|
// assetType == types.InitrdAsset
|
||||||
if err != nil {
|
clh.vmconfig.Payload.SetInitramfs(assetPath)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
clh.vmconfig.Payload.SetInitramfs(initrdPath)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if clh.config.ConfidentialGuest {
|
if clh.config.ConfidentialGuest {
|
||||||
|
Loading…
Reference in New Issue
Block a user