[libvirt PATCH 12/28] conf: Move nvramTemplate parsing

Andrea Bolognani abologna at redhat.com
Thu Jun 23 16:14:24 UTC 2022


It belongs to virDomainLoaderDefParseXMLNvram(), where the other
parts of the <nvram> element are handled.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/conf/domain_conf.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f19f6eb63c..fcb468b465 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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;
 }
 
-- 
2.35.3



More information about the libvir-list mailing list