Currently when the vcpu placement is static
and cpuset is not specified, CPU Affinity
under virsh emulatorpin shows 0..CPUMAX. This
patchset will result in display of only
online CPU's under CPU Affinity on linux.
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
src/qemu/qemu_driver.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a82e58b..51efe28 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5409,6 +5409,11 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
virBitmapPtr cpumask = NULL;
virBitmapPtr bitmap = NULL;
virBitmapPtr autoCpuset = NULL;
+ virBitmapPtr staticCpuset = NULL;
+
+#ifdef __linux__
+ staticCpuset = virHostCPUGetOnlineBitmap();
+#endif
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG, -1);
@@ -5435,6 +5440,9 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
} else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO
&&
autoCpuset) {
cpumask = autoCpuset;
+ } else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC
&&
+ staticCpuset) {
+ cpumask = staticCpuset;
} else {
if (!(bitmap = virBitmapNew(hostcpus)))
goto cleanup;
@@ -5449,6 +5457,7 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
virBitmapFree(bitmap);
+ virBitmapFree(staticCpuset);
return ret;
}
--
2.1.0