mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +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>
This commit is contained in:
parent
1a0092d631
commit
9fda7059a5
@ -538,14 +538,14 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
|
||||
clh.vmconfig.Rng = chclient.NewRngConfig(clh.config.EntropySource)
|
||||
|
||||
// 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()
|
||||
@ -559,7 +559,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
|
||||
|
||||
if clh.vmconfig.Pmem != nil {
|
||||
@ -569,12 +569,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