]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: hotplug: print correct vcpu when validating hot(un)plug config
authorPeter Krempa <pkrempa@redhat.com>
Fri, 12 May 2017 15:46:31 +0000 (17:46 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 22 May 2017 07:14:35 +0000 (09:14 +0200)
The error message would contain first vcpu id after the list of vcpus
selected for modification. To print the proper vcpu id remember the
first vcpu selected to be modified.

src/qemu/qemu_hotplug.c

index e8d29186eb32581edbb9fc03fb9658784a864601..1d7f2cc71b0e695b1a98adcf6e9b84f87d9c1d8b 100644 (file)
@@ -5866,6 +5866,7 @@ qemuDomainVcpuValidateConfig(virDomainDefPtr def,
     virDomainVcpuDefPtr vcpu;
     size_t maxvcpus = virDomainDefGetVcpusMax(def);
     ssize_t next;
+    ssize_t firstvcpu = -1;
 
     /* vcpu 0 can't be disabled */
     if (!state && virBitmapIsBitSet(map, 0)) {
@@ -5880,13 +5881,17 @@ qemuDomainVcpuValidateConfig(virDomainDefPtr def,
             continue;
 
         /* skip vcpus being modified */
-        if (virBitmapIsBitSet(map, next))
+        if (virBitmapIsBitSet(map, next)) {
+            if (firstvcpu < 0)
+                firstvcpu = next;
+
             continue;
+        }
 
         if (vcpu->online && vcpu->hotpluggable == VIR_TRISTATE_BOOL_NO) {
             virReportError(VIR_ERR_INVALID_ARG,
                            _("vcpu '%zd' can't be modified as it is followed "
-                             "by non-hotpluggable online vcpus"), next);
+                             "by non-hotpluggable online vcpus"), firstvcpu);
             return -1;
         }
     }