runtime/fc: fix image/initrd annotation handling

Right now if we configure an image annotation and have a config file
setting initrd, the initrd config would override the image annotation.

Make sure annotations are preferred over config options in image and initrd
path handling.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao 2023-08-22 07:53:34 +00:00
parent 9fda7059a5
commit 18d42da21e

View File

@ -721,19 +721,12 @@ func (fc *firecracker) fcInitConfiguration(ctx context.Context) error {
return err
}
image, err := fc.config.InitrdAssetPath()
assetPath, _, err := fc.config.ImageOrInitrdAssetPath()
if err != nil {
return err
}
if image == "" {
image, err = fc.config.ImageAssetPath()
if err != nil {
return err
}
}
if err := fc.fcSetVMRootfs(ctx, image); err != nil {
if err := fc.fcSetVMRootfs(ctx, assetPath); err != nil {
return err
}