Create virDomainDefParseName that parses only the name from XML
definition. This will be used in future patches.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
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 145106b75c94..0aea59f37a13 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14760,6 +14760,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,
@@ -14885,11 +14898,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.6.3