separate virDomainDefParseMemballoonInfo from virDomainDefParseXML,
move virDomainDefParseMemballoonInfo into virDomainDefParseDeviceInfo
---
src/conf/domain_conf.c | 58 +++++++++++++++++++++++++++++++++-----------------
1 file changed, 38 insertions(+), 20 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b2a1b34..42736e3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20505,6 +20505,43 @@ virDomainDefParseWatchdogInfo(virDomainParseTotalParamPtr param)
static int
+virDomainDefParseMemballoonInfo(virDomainParseTotalParamPtr param)
+{
+ virDomainDefPtr def = param->def;
+ xmlXPathContextPtr ctxt = param->ctxt;
+ virDomainXMLOptionPtr xmlopt = param->xmlopt;
+ unsigned int flags = param->flags;
+
+ int ret = -1;
+ int n = 0;
+ xmlNodePtr *nodes = NULL;
+
+ /* analysis of the memballoon devices */
+ def->memballoon = NULL;
+ if ((n = virXPathNodeSet("./devices/memballoon", ctxt, &nodes)) <
0)
+ goto cleanup;
+ if (n > 1) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only a single memory balloon device is supported"));
+ goto cleanup;
+ }
+ if (n > 0) {
+ virDomainMemballoonDefPtr memballoon;
+
+ memballoon = virDomainMemballoonDefParseXML(xmlopt, nodes[0], ctxt, flags);
+ if (!memballoon)
+ goto cleanup;
+
+ def->memballoon = memballoon;
+ }
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(nodes);
+ return ret;
+}
+
+static int
virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
{
typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param);
@@ -20528,6 +20565,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
virDomainDefParseVideoInfo,
virDomainDefParseHostdevInfo,
virDomainDefParseWatchdogInfo,
+ virDomainDefParseMemballoonInfo,
NULL
};
@@ -20631,26 +20669,6 @@ virDomainDefParseXML(xmlDocPtr xml,
fun_index++;
}
- /* analysis of the memballoon devices */
- def->memballoon = NULL;
- if ((n = virXPathNodeSet("./devices/memballoon", ctxt, &nodes)) <
0)
- goto error;
- if (n > 1) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("only a single memory balloon device is supported"));
- goto error;
- }
- if (n > 0) {
- virDomainMemballoonDefPtr memballoon;
-
- memballoon = virDomainMemballoonDefParseXML(xmlopt, nodes[0], ctxt, flags);
- if (!memballoon)
- goto error;
-
- def->memballoon = memballoon;
- VIR_FREE(nodes);
- }
-
/* Parse the RNG devices */
if ((n = virXPathNodeSet("./devices/rng", ctxt, &nodes)) < 0)
goto error;
--
2.8.3