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 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