[PATCH v1 47/51] util: conf: separate virDomainDefParseSysinfoInfo from virDomainDefParseXML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



separate virDomainDefParseSysinfoInfo from virDomainDefParseXML
---
 src/conf/domain_conf.c | 40 ++++++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index de8a9fc..a8fc27c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20997,6 +20997,33 @@ virDomainDefParseIdmapInfo(virDomainParseTotalParamPtr param)
 }
 
 
+static int
+virDomainDefParseSysinfoInfo(virDomainParseTotalParamPtr param)
+{
+    virDomainDefPtr def = param->def;
+    xmlXPathContextPtr ctxt = param->ctxt;
+    bool uuid_generated = param->uuid_generated;
+
+    int ret = -1;
+    xmlNodePtr node = NULL;
+
+    if ((node = virXPathNode("./sysinfo[1]", ctxt)) != NULL) {
+        xmlNodePtr oldnode = ctxt->node;
+        ctxt->node = node;
+        def->sysinfo = virSysinfoParseXML(node, ctxt,
+                                          def->uuid, uuid_generated);
+        ctxt->node = oldnode;
+
+        if (def->sysinfo == NULL)
+            goto cleanup;
+    }
+    ret = 0;
+
+ cleanup:
+    return ret;
+}
+
+
 static virDomainDefPtr
 virDomainDefParseXML(xmlDocPtr xml,
                      xmlNodePtr root,
@@ -21012,7 +21039,6 @@ virDomainDefParseXML(xmlDocPtr xml,
     char *tmp = NULL;
     size_t fun_index = 0;
     virDomainDefPtr def;
-    bool uuid_generated = false;
     virHashTablePtr bootHash = NULL;
     virDomainParseTotalParam param = {
             xml,
@@ -21052,6 +21078,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             virDomainDefParseBootOptionsInfo,
             virDomainDefParseDeviceInfo,
             virDomainDefParseIdmapInfo,
+            virDomainDefParseSysinfoInfo,
             NULL
     };
 
@@ -21083,17 +21110,6 @@ virDomainDefParseXML(xmlDocPtr xml,
         fun_index++;
     }
 
-    if ((node = virXPathNode("./sysinfo[1]", ctxt)) != NULL) {
-        xmlNodePtr oldnode = ctxt->node;
-        ctxt->node = node;
-        def->sysinfo = virSysinfoParseXML(node, ctxt,
-                                          def->uuid, uuid_generated);
-        ctxt->node = oldnode;
-
-        if (def->sysinfo == NULL)
-            goto error;
-    }
-
     if (virDomainKeyWrapDefParseXML(def, ctxt) < 0)
         goto error;
 
-- 
2.8.3


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux