virDomainVcpuPinDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
int maxvcpus,
- bool emulator,
bool iothreads)
{
virDomainPinDefPtr def;
ctxt->node = node;
- if (!emulator && !iothreads) {
+ if (!iothreads) {
ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid);
if ((ret == -2) || (vcpuid < -1)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
}
if (!(tmp = virXMLPropString(node, "cpuset"))) {
- if (emulator)
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("missing cpuset for emulatorpin"));
- else if (iothreads)
+ if (iothreads)
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing cpuset for iothreadpin"));
else
}
+/* Parse the XML definition for emulatorpin.
+ * emulatorpin has the form of
+ * <emulatorpin cpuset='0'/>
+ */
+static virDomainPinDefPtr
+virDomainEmulatorPinDefParseXML(xmlNodePtr node)
+{
+ virDomainPinDefPtr def;
+ char *tmp = NULL;
+
+ if (VIR_ALLOC(def) < 0)
+ return NULL;
+
+ if (!(tmp = virXMLPropString(node, "cpuset"))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("missing cpuset for emulatorpin"));
+ goto error;
+ }
+
+ if (virBitmapParse(tmp, 0, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ goto error;
+
+ VIR_FREE(tmp);
+ return def;
+
+ error:
+ VIR_FREE(tmp);
+ VIR_FREE(def);
+ return NULL;
+}
+
+
int
virDomainDefMaybeAddController(virDomainDefPtr def,
int type,
for (i = 0; i < n; i++) {
virDomainPinDefPtr vcpupin = NULL;
vcpupin = virDomainVcpuPinDefParseXML(nodes[i], ctxt,
- def->maxvcpus, false, false);
+ def->maxvcpus, false);
if (!vcpupin)
goto error;
goto error;
}
- def->cputune.emulatorpin = virDomainVcpuPinDefParseXML(nodes[0],
- ctxt, 0,
- true, false);
-
- if (!def->cputune.emulatorpin)
+ if (!(def->cputune.emulatorpin = virDomainEmulatorPinDefParseXML(nodes[0])))
goto error;
}
VIR_FREE(nodes);
virDomainPinDefPtr iothreadpin = NULL;
iothreadpin = virDomainVcpuPinDefParseXML(nodes[i], ctxt,
def->iothreads,
- false, true);
+ true);
if (!iothreadpin)
goto error;