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>
(cherry picked from commit 18d42da21e)
Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
Peng Tao 2023-08-22 07:53:34 +00:00 committed by Greg Kurz
parent f86bfe0da3
commit 9ce8ee6c0c

View File

@ -722,19 +722,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
}