diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d87ca6b7fa..42df928a30 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -384,6 +384,7 @@
<vcpupin vcpu="1" cpuset="0,1"/>
<vcpupin vcpu="2" cpuset="2,3"/>
<vcpupin vcpu="3" cpuset="0,4"/>
+ <emulatorpin cpuset="1-3"/%gt;
<shares>2048</shares>
<period>1000000</period>
<quota>-1</quota>
@@ -410,6 +411,14 @@
of element vcpu
. (NB: Only qemu driver support)
Since 0.9.0
+
emulatorpin
+
+ The optional emulatorpin
element specifies which of host
+ physical CPUs the "emulator", a subset of a domain not including vcpu,
+ will be pinned to. If this is ommitted, "emulator" is pinned to all
+ the physical CPUs by default. It contains one required attribute
+ cpuset
specifying which physical CPUs to pin to.
+
shares
The optional shares
element specifies the proportional
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 8a1782ac71..f4005c51e2 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -591,6 +591,13 @@
+
+
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ee247f6388..304ab88e78 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8377,6 +8377,35 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
}
VIR_FREE(nodes);
+ if ((n = virXPathNodeSet("./cputune/emulatorpin", ctxt, &nodes)) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot extract emulatorpin nodes"));
+ goto error;
+ }
+
+ if (n) {
+ if (n > 1) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("only one emulatorpin is supported"));
+ VIR_FREE(nodes);
+ goto error;
+ }
+
+ if (VIR_ALLOC(def->cputune.emulatorpin) < 0) {
+ goto no_memory;
+ }
+
+ virDomainVcpuPinDefPtr emulatorpin = NULL;
+ emulatorpin = virDomainVcpuPinDefParseXML(nodes[0], ctxt,
+ def->maxvcpus, 1);
+
+ if (!emulatorpin)
+ goto error;
+
+ def->cputune.emulatorpin = emulatorpin;
+ }
+ VIR_FREE(nodes);
+
/* Extract numatune if exists. */
if ((n = virXPathNodeSet("./numatune", ctxt, &nodes)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -13001,7 +13030,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virBufferAsprintf(buf, ">%u\n", def->maxvcpus);
if (def->cputune.shares || def->cputune.vcpupin ||
- def->cputune.period || def->cputune.quota)
+ def->cputune.period || def->cputune.quota ||
+ def->cputune.emulatorpin)
virBufferAddLit(buf, " \n");
if (def->cputune.shares)
@@ -13033,8 +13063,25 @@ virDomainDefFormatInternal(virDomainDefPtr def,
}
}
+ if (def->cputune.emulatorpin) {
+ virBufferAsprintf(buf, " cputune.emulatorpin->cpumask,
+ VIR_DOMAIN_CPUMASK_LEN);
+ if (cpumask == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("failed to format cpuset for emulator"));
+ goto cleanup;
+ }
+
+ virBufferAsprintf(buf, "cpuset='%s'/>\n", cpumask);
+ VIR_FREE(cpumask);
+ }
+
if (def->cputune.shares || def->cputune.vcpupin ||
- def->cputune.period || def->cputune.quota)
+ def->cputune.period || def->cputune.quota ||
+ def->cputune.emulatorpin)
virBufferAddLit(buf, " \n");
if (def->numatune.memory.nodemask ||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9002222369..8cd685e4c3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1616,6 +1616,7 @@ struct _virDomainDef {
long long quota;
int nvcpupin;
virDomainVcpuPinDefPtr *vcpupin;
+ virDomainVcpuPinDefPtr emulatorpin;
} cputune;
virDomainNumatuneDef numatune;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cputune.xml b/tests/qemuxml2argvdata/qemuxml2argv-cputune.xml
index df3101d6c3..593e650d7b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cputune.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cputune.xml
@@ -10,6 +10,7 @@
-1
+
hvm