mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 08:17:37 +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)
|
clh.vmconfig.Rng = chclient.NewRngConfig(clh.config.EntropySource)
|
||||||
|
|
||||||
// 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()
|
||||||
@ -559,7 +559,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
|
||||||
|
|
||||||
if clh.vmconfig.Pmem != nil {
|
if clh.vmconfig.Pmem != nil {
|
||||||
@ -569,12 +569,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