separate virDomainDefParseCpuNumaInfo from virDomainDefParseXML
---
src/conf/domain_conf.c | 77 ++++++++++++++++++++++++++++++--------------------
1 file changed, 46 insertions(+), 31 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e50e56f..892e871 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19229,6 +19229,51 @@ virDomainDefParseCputuneInfo(virDomainParseTotalParamPtr param)
}
+static int
+virDomainDefParseCpuNumaInfo(virDomainParseTotalParamPtr param)
+{
+ virDomainDefPtr def = param->def;
+ xmlXPathContextPtr ctxt = param->ctxt;
+ int ret = -1;
+
+ if (virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST,
&def->cpu) < 0)
+ goto cleanup;
+
+ if (virDomainNumaDefCPUParseXML(def->numa, ctxt) < 0)
+ goto cleanup;
+
+ if (virDomainNumaGetCPUCountTotal(def->numa) > virDomainDefGetVcpusMax(def)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Number of CPUs in <numa> exceeds the"
+ " <vcpu> count"));
+ goto cleanup;
+ }
+
+ if (virDomainNumaGetMaxCPUID(def->numa) >= virDomainDefGetVcpusMax(def)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("CPU IDs in <numa> exceed the <vcpu>
count"));
+ goto cleanup;
+ }
+
+ if (virDomainNumatuneParseXML(def->numa,
+ def->placement_mode ==
+ VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
+ ctxt) < 0)
+ goto cleanup;
+
+ if (virDomainNumatuneHasPlacementAuto(def->numa) &&
+ !def->cpumask && !virDomainDefHasVcpuPin(def) &&
+ !def->cputune.emulatorpin &&
+ !virDomainIOThreadIDArrayHasPin(def))
+ def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;
+
+ ret = 0;
+
+ cleanup:
+ return ret;
+}
+
+
static virDomainDefPtr
virDomainDefParseXML(xmlDocPtr xml,
xmlNodePtr root,
@@ -19279,6 +19324,7 @@ virDomainDefParseXML(xmlDocPtr xml,
virDomainDefParseVcpuInfo,
virDomainDefParseIoThreadInfo,
virDomainDefParseCputuneInfo,
+ virDomainDefParseCpuNumaInfo,
NULL
};
@@ -19306,37 +19352,6 @@ virDomainDefParseXML(xmlDocPtr xml,
fun_index++;
}
- if (virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST,
&def->cpu) < 0)
- goto error;
-
- if (virDomainNumaDefCPUParseXML(def->numa, ctxt) < 0)
- goto error;
-
- if (virDomainNumaGetCPUCountTotal(def->numa) > virDomainDefGetVcpusMax(def)) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Number of CPUs in <numa> exceeds the"
- " <vcpu> count"));
- goto error;
- }
-
- if (virDomainNumaGetMaxCPUID(def->numa) >= virDomainDefGetVcpusMax(def)) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("CPU IDs in <numa> exceed the <vcpu>
count"));
- goto error;
- }
-
- if (virDomainNumatuneParseXML(def->numa,
- def->placement_mode ==
- VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
- ctxt) < 0)
- goto error;
-
- if (virDomainNumatuneHasPlacementAuto(def->numa) &&
- !def->cpumask && !virDomainDefHasVcpuPin(def) &&
- !def->cputune.emulatorpin &&
- !virDomainIOThreadIDArrayHasPin(def))
- def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;
-
if ((n = virXPathNodeSet("./resource", ctxt, &nodes)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract resource nodes"));
--
2.8.3