]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fix EmulatorPinInfo without emulatorpin
authorMartin Kletzander <mkletzan@redhat.com>
Wed, 31 Oct 2012 14:49:08 +0000 (15:49 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 31 Oct 2012 15:27:02 +0000 (16:27 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=871312

Recent fixes made almost all the right steps to make emulator pinned
to the cpuset of the whole domain in case <emulatorpin> isn't
specified, but qemudDomainGetEmulatorPinInfo still reports all the
CPUs even when cpuset is specified.  This patch fixes that.

src/qemu/qemu_driver.c

index 3980c10debea4e9b8dbf68cc30e3e9fbc0693ebd..8b5f06a896065cccdaece0d499cc76980a4f992f 100644 (file)
@@ -4352,7 +4352,6 @@ qemudDomainGetEmulatorPinInfo(virDomainPtr dom,
     virDomainDefPtr targetDef = NULL;
     int ret = -1;
     int maxcpu, hostcpus, pcpu;
-    virDomainVcpuPinDefPtr emulatorpin = NULL;
     virBitmapPtr cpumask = NULL;
     bool pinned;
 
@@ -4394,14 +4393,15 @@ qemudDomainGetEmulatorPinInfo(virDomainPtr dom,
         cpumaps[maplen - 1] &= (1 << maxcpu % 8) - 1;
     }
 
-    /* If no emulatorpin, all cpus should be used */
-    emulatorpin = targetDef->cputune.emulatorpin;
-    if (!emulatorpin) {
+    if (targetDef->cputune.emulatorpin) {
+        cpumask = targetDef->cputune.emulatorpin->cpumask;
+    } else if (targetDef->cpumask) {
+        cpumask = targetDef->cpumask;
+    } else {
         ret = 0;
         goto cleanup;
     }
 
-    cpumask = emulatorpin->cpumask;
     for (pcpu = 0; pcpu < maxcpu; pcpu++) {
         if (virBitmapGetBit(cpumask, pcpu, &pinned) < 0)
             goto cleanup;