mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
libxl: correctly handle affinity reset in virDomainPinVcpu[Flags]
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@citrix.com> Cc: Jim Fehlig <jfehlig@suse.com> Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
This commit is contained in:
parent
520c3fbd1b
commit
9375ba2a6e
@ -2365,6 +2365,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
|
|||||||
libxlDriverPrivatePtr driver = dom->conn->privateData;
|
libxlDriverPrivatePtr driver = dom->conn->privateData;
|
||||||
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
|
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
|
||||||
virDomainDefPtr targetDef = NULL;
|
virDomainDefPtr targetDef = NULL;
|
||||||
|
virBitmapPtr pcpumap = NULL;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@ -2394,6 +2395,10 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
|
|||||||
/* Make sure coverity knows targetDef is valid at this point. */
|
/* Make sure coverity knows targetDef is valid at this point. */
|
||||||
sa_assert(targetDef);
|
sa_assert(targetDef);
|
||||||
|
|
||||||
|
pcpumap = virBitmapNewData(cpumap, maplen);
|
||||||
|
if (!pcpumap)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||||
libxl_bitmap map = { .size = maplen, .map = cpumap };
|
libxl_bitmap map = { .size = maplen, .map = cpumap };
|
||||||
libxlDomainObjPrivatePtr priv;
|
libxlDomainObjPrivatePtr priv;
|
||||||
@ -2407,6 +2412,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 (!targetDef->cputune.vcpupin) {
|
||||||
if (VIR_ALLOC(targetDef->cputune.vcpupin) < 0)
|
if (VIR_ALLOC(targetDef->cputune.vcpupin) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2422,6 +2438,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||||
@ -2433,6 +2450,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (vm)
|
if (vm)
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
|
virBitmapFree(pcpumap);
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user