]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Move nvramTemplate parsing
authorAndrea Bolognani <abologna@redhat.com>
Thu, 16 Jun 2022 15:52:14 +0000 (17:52 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 1 Jul 2022 13:10:21 +0000 (15:10 +0200)
It belongs to virDomainLoaderDefParseXMLNvram(), where the other
parts of the <nvram> element are handled.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c

index f19f6eb63cec0ff8a3504751714502004426c406..fcb468b4653d7d169214528b1a2f65c5586c1e29 100644 (file)
@@ -17996,11 +17996,15 @@ static int
 virDomainLoaderDefParseXMLNvram(virDomainLoaderDef *loader,
                                 xmlXPathContextPtr ctxt,
                                 virDomainXMLOption *xmlopt,
-                                unsigned int flags)
+                                unsigned int flags,
+                                bool fwAutoSelect)
 {
     g_autofree char *nvramType = virXPathString("string(./os/nvram/@type)", ctxt);
     g_autoptr(virStorageSource) src = virStorageSourceNew();
 
+    if (!fwAutoSelect)
+        loader->nvramTemplate = virXPathString("string(./os/nvram[1]/@template)", ctxt);
+
     src->format = VIR_STORAGE_FILE_RAW;
 
     if (!nvramType) {
@@ -18468,12 +18472,11 @@ virDomainDefParseBootLoaderOptions(virDomainDef *def,
                                    fwAutoSelect) < 0)
         return -1;
 
-    if (virDomainLoaderDefParseXMLNvram(def->os.loader, ctxt, xmlopt, flags) < 0)
+    if (virDomainLoaderDefParseXMLNvram(def->os.loader,
+                                        ctxt, xmlopt, flags,
+                                        fwAutoSelect) < 0)
         return -1;
 
-    if (!fwAutoSelect)
-        def->os.loader->nvramTemplate = virXPathString("string(./os/nvram[1]/@template)", ctxt);
-
     return 0;
 }