separate virDomainDefParsePMStateInfo from virDomainDefParseXML
---
src/conf/domain_conf.c | 83 ++++++++++++++++++++++++++++----------------------
1 file changed, 47 insertions(+), 36 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8374b9d..248472b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15329,29 +15329,6 @@ virDomainPerfEventDefParseXML(virDomainPerfDefPtr perf,
return ret;
}
-static int
-virDomainPerfDefParseXML(virDomainDefPtr def,
- xmlXPathContextPtr ctxt)
-{
- size_t i;
- int ret = -1;
- xmlNodePtr *nodes = NULL;
- int n;
-
- if ((n = virXPathNodeSet("./perf/event", ctxt, &nodes)) < 0)
- return n;
-
- for (i = 0; i < n; i++) {
- if (virDomainPerfEventDefParseXML(&def->perf, nodes[i]) < 0)
- goto cleanup;
- }
-
- ret = 0;
-
- cleanup:
- VIR_FREE(nodes);
- return ret;
-}
static int
virDomainMemorySourceDefParseXML(xmlNodePtr node,
@@ -19660,6 +19637,51 @@ virDomainDefParseEventActionInfo(virDomainParseTotalParamPtr
param)
}
+static int
+virDomainDefParsePMStateInfo(virDomainParseTotalParamPtr param)
+{
+ int ret = -1;
+ if (virDomainPMStateParseXML(param->ctxt,
+ "string(./pm/suspend-to-mem/@enabled)",
+ ¶m->def->pm.s3) < 0)
+ goto cleanup;
+
+ if (virDomainPMStateParseXML(param->ctxt,
+ "string(./pm/suspend-to-disk/@enabled)",
+ ¶m->def->pm.s4) < 0)
+ goto cleanup;
+
+ ret = 0;
+ cleanup:
+ return ret;
+}
+
+
+static int
+virDomainDefParsePerfEventInfo(virDomainParseTotalParamPtr param)
+{
+ size_t i;
+ int ret = -1;
+ xmlNodePtr *nodes = NULL;
+ int n;
+
+ if ((n = virXPathNodeSet("./perf/event", param->ctxt, &nodes)) <
0)
+ return n;
+
+ for (i = 0; i < n; i++) {
+ if (virDomainPerfEventDefParseXML(¶m->def->perf, nodes[i]) < 0)
+ goto cleanup;
+ }
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(nodes);
+ return ret;
+
+}
+
+
static virDomainDefPtr
virDomainDefParseXML(xmlDocPtr xml,
xmlNodePtr root,
@@ -19714,6 +19736,8 @@ virDomainDefParseXML(xmlDocPtr xml,
virDomainDefParseResourceInfo,
virDomainDefParseFeatureInfo,
virDomainDefParseEventActionInfo,
+ virDomainDefParsePMStateInfo,
+ virDomainDefParsePerfEventInfo,
NULL
};
@@ -19741,19 +19765,6 @@ virDomainDefParseXML(xmlDocPtr xml,
fun_index++;
}
- if (virDomainPMStateParseXML(ctxt,
- "string(./pm/suspend-to-mem/@enabled)",
- &def->pm.s3) < 0)
- goto error;
-
- if (virDomainPMStateParseXML(ctxt,
- "string(./pm/suspend-to-disk/@enabled)",
- &def->pm.s4) < 0)
- goto error;
-
- if (virDomainPerfDefParseXML(def, ctxt) < 0)
- goto error;
-
if ((tmp = virXPathString("string(./clock/@offset)", ctxt)) &&
(def->clock.offset = virDomainClockOffsetTypeFromString(tmp)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
--
2.8.3