render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
7a3408
From 739c64c914deae4be776f255540187793a3dc1de Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <739c64c914deae4be776f255540187793a3dc1de@dist-git>
7a3408
From: Martin Kletzander <mkletzan@redhat.com>
7a3408
Date: Thu, 13 Aug 2015 15:11:48 +0200
7a3408
Subject: [PATCH] qemu: Use numad information when getting pin information
7a3408
7a3408
Pinning information returned for emulatorpin and vcpupin calls is being
7a3408
returned from our data without querying cgroups for some time.  However,
7a3408
not all the data were utilized.  When automatic placement is used the
7a3408
information is not returned for the calls mentioned above.  Since the
7a3408
numad hint in private data is properly saved/restored, we can safely use
7a3408
it to return true information.
7a3408
7a3408
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1162947
7a3408
7a3408
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7a3408
(cherry picked from commit 776924e37649f2d47acd805746d5fd9325212ea5)
7a3408
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_driver.c | 11 +++++++++++
7a3408
 1 file changed, 11 insertions(+)
7a3408
7a3408
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
7a3408
index 48857ce..748f16a 100644
7a3408
--- a/src/qemu/qemu_driver.c
7a3408
+++ b/src/qemu/qemu_driver.c
7a3408
@@ -5244,6 +5244,7 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
7a3408
     int ret = -1;
7a3408
     int hostcpus, vcpu;
7a3408
     virBitmapPtr allcpumap = NULL;
7a3408
+    qemuDomainObjPrivatePtr priv = NULL;
7a3408
 
7a3408
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
7a3408
                   VIR_DOMAIN_AFFECT_CONFIG, -1);
7a3408
@@ -5264,6 +5265,7 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
7a3408
         goto cleanup;
7a3408
 
7a3408
     virBitmapSetAll(allcpumap);
7a3408
+    priv = vm->privateData;
7a3408
 
7a3408
     /* Clamp to actual number of vcpus */
7a3408
     if (ncpumaps > def->vcpus)
7a3408
@@ -5282,6 +5284,9 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
7a3408
 
7a3408
         if (pininfo && pininfo->cpumask)
7a3408
             bitmap = pininfo->cpumask;
7a3408
+        else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO &&
7a3408
+                 priv->autoCpuset)
7a3408
+            bitmap = priv->autoCpuset;
7a3408
         else
7a3408
             bitmap = allcpumap;
7a3408
 
7a3408
@@ -5432,6 +5437,7 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
7a3408
     int hostcpus;
7a3408
     virBitmapPtr cpumask = NULL;
7a3408
     virBitmapPtr bitmap = NULL;
7a3408
+    qemuDomainObjPrivatePtr priv = NULL;
7a3408
 
7a3408
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
7a3408
                   VIR_DOMAIN_AFFECT_CONFIG, -1);
7a3408
@@ -5448,10 +5454,15 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
7a3408
     if ((hostcpus = nodeGetCPUCount(NULL)) < 0)
7a3408
         goto cleanup;
7a3408
 
7a3408
+    priv = vm->privateData;
7a3408
+
7a3408
     if (def->cputune.emulatorpin) {
7a3408
         cpumask = def->cputune.emulatorpin;
7a3408
     } else if (def->cpumask) {
7a3408
         cpumask = def->cpumask;
7a3408
+    } else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO &&
7a3408
+               priv->autoCpuset) {
7a3408
+        cpumask = priv->autoCpuset;
7a3408
     } else {
7a3408
         if (!(bitmap = virBitmapNew(hostcpus)))
7a3408
             goto cleanup;
7a3408
-- 
7a3408
2.5.0
7a3408