]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Error out if the bitmap for pinning is all clear
authorOsier Yang <jyang@redhat.com>
Tue, 2 Apr 2013 05:42:14 +0000 (13:42 +0800)
committerOsier Yang <jyang@redhat.com>
Sat, 6 Apr 2013 02:16:59 +0000 (10:16 +0800)
For both "live" and "config" changes of vcpupin and emulatorpin, an
all clear bitmap doesn't make sense, and it can just cause corruptions.
E.g (similar for emulatorpin).

% virsh vcpupin hame 0 8,^8 --config

% virsh vcpupin hame
VCPU: CPU Affinity
----------------------------------
   0:
   1: 0-63
   2: 0-63
   3: 0-63

% virsh dumpxml hame | grep cpuset
    <vcpupin vcpu='0' cpuset=''/>

% virsh start hame
error: Failed to start domain hame
error: An error occurred, but the cause is unknown

src/qemu/qemu_driver.c

index eba53dae411117994a8c06024d71e989b52ed3e4..997d7c3162ace142969f9be38508af71b96fe6fb 100644 (file)
@@ -3873,6 +3873,12 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
     if (!pcpumap)
         goto cleanup;
 
+    if (virBitmapIsAllClear(pcpumap)) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("Empty cpu list for pinning"));
+        goto cleanup;
+    }
+
     /* pinning to all physical cpus means resetting,
      * so check if we can reset setting.
      */
@@ -4142,6 +4148,12 @@ qemuDomainPinEmulator(virDomainPtr dom,
     if (!pcpumap)
         goto cleanup;
 
+    if (virBitmapIsAllClear(pcpumap)) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("Empty cpu list for pinning"));
+        goto cleanup;
+    }
+
     /* pinning to all physical cpus means resetting,
      * so check if we can reset setting.
      */