From 9ce8ee6c0ca65b6bcd6756eac1c8e95d458f2e56 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 22 Aug 2023 07:53:34 +0000 Subject: [PATCH] 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 (cherry picked from commit 18d42da21ea1ee39401fb7a0d436fb8922366392) Signed-off-by: Greg Kurz --- src/runtime/virtcontainers/fc.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/runtime/virtcontainers/fc.go b/src/runtime/virtcontainers/fc.go index 520d73eaa3..c7139a4a49 100644 --- a/src/runtime/virtcontainers/fc.go +++ b/src/runtime/virtcontainers/fc.go @@ -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 }