[PATCH v1 02/51] util: conf: separate virDomainDefParseIdInfo from virDomainDefParseXML

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

 



separate virDomainDefParseIdInfo from virDomainDefParseXML
---
 src/conf/domain_conf.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e36783b..055404e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18549,6 +18549,22 @@ struct _virDomainParseTotalParam{
 };
 
 
+static int
+virDomainDefParseIdInfo(virDomainParseTotalParamPtr param)
+{
+    unsigned int flags = param->flags;
+    xmlXPathContextPtr ctxt = param->ctxt;
+    virDomainDefPtr def = param->def;
+    long id = -1;
+
+    if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE))
+        if (virXPathLong("string(./@id)", ctxt, &id) < 0)
+            id = -1;
+    def->id = (int)id;
+    return 0;
+}
+
+
 static virDomainDefPtr
 virDomainDefParseXML(xmlDocPtr xml,
                      xmlNodePtr root,
@@ -18564,7 +18580,6 @@ virDomainDefParseXML(xmlDocPtr xml,
     char *tmp = NULL;
     size_t i, j;
     int n, virtType, gic_version;
-    long id = -1;
     size_t fun_index = 0;
     virDomainDefPtr def;
     bool uuid_generated = false;
@@ -18590,6 +18605,7 @@ virDomainDefParseXML(xmlDocPtr xml,
     };
 
     virDomainPreaseInfoFunc parse_funs[] = {
+            virDomainDefParseIdInfo,
             NULL
     };
 
@@ -18617,11 +18633,6 @@ virDomainDefParseXML(xmlDocPtr xml,
         fun_index++;
     }
 
-    if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE))
-        if (virXPathLong("string(./@id)", ctxt, &id) < 0)
-            id = -1;
-    def->id = (int)id;
-
     /* Find out what type of virtualization to use */
     if (!(tmp = virXMLPropString(ctxt->node, "type"))) {
         virReportError(VIR_ERR_INTERNAL_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