]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Move type=rom default for loader to drivers
authorAndrea Bolognani <abologna@redhat.com>
Tue, 3 Feb 2026 14:18:39 +0000 (15:18 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 24 Feb 2026 10:29:06 +0000 (11:29 +0100)
Right now we set this default in the common parsing code, which
is not a big problem per se but would get in the way of some
upcoming changes.

Leave this choice to individual drivers instead. Only the QEMU
and Xen drivers use the value for anything, so we can limit the
amount of code duplication this change causes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/conf/domain_postparse.c
src/libxl/libxl_domain.c
src/qemu/qemu_firmware.c

index 38e731348df97a30d3a6fea27cf6eca1b1198feb..cbaae75c02fc55ab2a14260c9f6e858cc3c701b4 100644 (file)
@@ -89,22 +89,6 @@ virDomainDefPostParseMemory(virDomainDef *def,
 }
 
 
-static int
-virDomainDefPostParseOs(virDomainDef *def)
-{
-    if (!def->os.loader)
-        return 0;
-
-    if (def->os.loader->path &&
-        def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_NONE) {
-        /* By default, loader is type of 'rom' */
-        def->os.loader->type = VIR_DOMAIN_LOADER_TYPE_ROM;
-    }
-
-    return 0;
-}
-
-
 static void
 virDomainDefPostParseMemtune(virDomainDef *def)
 {
@@ -1251,9 +1235,6 @@ virDomainDefPostParseCommon(virDomainDef *def,
     if (virDomainDefPostParseMemory(def, data->parseFlags) < 0)
         return -1;
 
-    if (virDomainDefPostParseOs(def) < 0)
-        return -1;
-
     virDomainDefPostParseMemtune(def);
 
     if (virDomainDefRejectDuplicateControllers(def) < 0)
index 9842d6fece8fd76130fb8a215e74ef457664ad48..c6717e31cf0fa45f2cd0952b9f972c229f7e8b73 100644 (file)
@@ -279,6 +279,12 @@ libxlDomainDefPostParse(virDomainDef *def,
             def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ON;
     }
 
+    if (def->os.loader &&
+        def->os.loader->path &&
+        !def->os.loader->type) {
+        def->os.loader->type = VIR_DOMAIN_LOADER_TYPE_ROM;
+    }
+
     /* add implicit balloon device */
     if (def->memballoon == NULL) {
         virDomainMemballoonDef *memballoon;
index 519828f6f904ab8da4c806c3659abf41a9bdc858..6a074055ca0f302b05b2d63bbaa0b3fa6b732442 100644 (file)
@@ -1662,6 +1662,11 @@ qemuFirmwareFillDomainCustom(virDomainDef *def)
     if (!loader)
         return;
 
+    if (loader->path &&
+        !loader->type) {
+        loader->type = VIR_DOMAIN_LOADER_TYPE_ROM;
+    }
+
     if (loader->path &&
         !loader->format) {
         loader->format = VIR_STORAGE_FILE_RAW;