[PATCH v3 2/2] conf: List only online cpus for virsh emulatorpin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]