By actually removing the <vcpupin> element (from within the
<cputune> section) from the XML, rather than jus update it with
a fully set vcpu affinity mask.
Signed-off-by: Dario Faggioli <dario.faggioli(a)citrix.com>
Cc: Jim Fehlig <jfehlig(a)suse.com>
Cc: Ian Jackson <Ian.Jackson(a)eu.citrix.com>
---
src/libxl/libxl_driver.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 4079434..9a0898a 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2363,6 +2363,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
libxlDriverPrivatePtr driver = dom->conn->privateData;
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
virDomainDefPtr targetDef = NULL;
+ virBitmapPtr pcpumap = NULL;
virDomainObjPtr vm;
int ret = -1;
@@ -2391,6 +2392,10 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
sa_assert(targetDef);
+ pcpumap = virBitmapNewData(cpumap, maplen);
+ if (!pcpumap)
+ goto cleanup;
+
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
libxl_bitmap map = { .size = maplen, .map = cpumap };
libxlDomainObjPrivatePtr priv;
@@ -2404,6 +2409,17 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
}
}
+ /* full bitmap means reset the settings (if any). */
+ if (virBitmapIsAllSet(pcpumap)) {
+ if (virDomainVcpuPinDel(targetDef, vcpu) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to delete vcpupin xml for vcpu
'%d'"),
+ vcpu);
+ goto cleanup;
+ }
+ goto out;
+ }
+
if (!targetDef->cputune.vcpupin) {
if (VIR_ALLOC(targetDef->cputune.vcpupin) < 0)
goto cleanup;
@@ -2419,6 +2435,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
goto cleanup;
}
+out:
ret = 0;
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
@@ -2430,6 +2447,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
cleanup:
if (vm)
virObjectUnlock(vm);
+ virBitmapFree(pcpumap);
virObjectUnref(cfg);
return ret;
}