mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-14 14:14:15 +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)
|
||||
|
||||
// set the initial root/boot disk of hypervisor
|
||||
imagePath, err := clh.config.ImageAssetPath()
|
||||
assetPath, assetType, err := clh.config.ImageOrInitrdAssetPath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if imagePath != "" {
|
||||
if assetType == types.ImageAsset {
|
||||
if clh.config.ConfidentialGuest {
|
||||
disk := chclient.NewDiskConfig(imagePath)
|
||||
disk := chclient.NewDiskConfig(assetPath)
|
||||
disk.SetReadonly(true)
|
||||
|
||||
diskRateLimiterConfig := clh.getDiskRateLimiterConfig()
|
||||
@ -570,7 +570,7 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
|
||||
clh.vmconfig.Disks = &[]chclient.DiskConfig{*disk}
|
||||
}
|
||||
} else {
|
||||
pmem := chclient.NewPmemConfig(imagePath)
|
||||
pmem := chclient.NewPmemConfig(assetPath)
|
||||
*pmem.DiscardWrites = true
|
||||
pmem.SetIommu(clh.config.IOMMU)
|
||||
|
||||
@ -581,12 +581,8 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
|
||||
}
|
||||
}
|
||||
} else {
|
||||
initrdPath, err := clh.config.InitrdAssetPath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
clh.vmconfig.Payload.SetInitramfs(initrdPath)
|
||||
// assetType == types.InitrdAsset
|
||||
clh.vmconfig.Payload.SetInitramfs(assetPath)
|
||||
}
|
||||
|
||||
if clh.config.ConfidentialGuest {
|
||||
|
Loading…
Reference in New Issue
Block a user