[RFC PATCH 3/8] conf: Extract name-parsing into its own function

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

 



Create virDomainDefParseName that parses only the name from XML
definition.  This will be used in future patches.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 564f66de25bb..c2aeca2e52a6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14579,6 +14579,19 @@ virDomainVcpuParse(virDomainDefPtr def,
     return ret;
 }

+static int
+virDomainDefParseName(virDomainDefPtr def,
+                      xmlXPathContextPtr ctxt)
+{
+    if (!(def->name = virXPathString("string(./name[1])", ctxt))) {
+        virReportError(VIR_ERR_NO_NAME, NULL);
+        return -1;
+    }
+
+    return 0;
+}
+
+
 static virDomainDefPtr
 virDomainDefParseXML(xmlDocPtr xml,
                      xmlNodePtr root,
@@ -14703,11 +14716,8 @@ virDomainDefParseXML(xmlDocPtr xml,
         VIR_FREE(capsdata);
     }

-    /* Extract domain name */
-    if (!(def->name = virXPathString("string(./name[1])", ctxt))) {
-        virReportError(VIR_ERR_NO_NAME, NULL);
+    if (virDomainDefParseName(def, ctxt) < 0)
         goto error;
-    }

     /* Extract domain uuid. If both uuid and sysinfo/system/entry/uuid
      * exist, they must match; and if only the latter exists, it can
-- 
2.5.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]