Blame SOURCES/libvirt-qemu-hotplug-Iterate-over-vcpu-0-in-individual-vcpu-hotplug-code.patch

3e5111
From 9dcf5d0029fe9b1e1e17b20070702bc1ce6382ad Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <9dcf5d0029fe9b1e1e17b20070702bc1ce6382ad@dist-git>
3e5111
From: Peter Krempa <pkrempa@redhat.com>
3e5111
Date: Tue, 4 Apr 2017 09:31:20 +0200
3e5111
Subject: [PATCH] qemu: hotplug: Iterate over vcpu 0 in individual vcpu hotplug
3e5111
 code
3e5111
3e5111
Buggy condition meant that vcpu0 would not be iterated in the checks.
3e5111
Since it's not hotpluggable anyways we would not be able to break the
3e5111
configuration of a live VM.
3e5111
3e5111
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1437013
3e5111
(cherry picked from commit 315f443dbb9f821fb207c30585e01dfbaac01878)
3e5111
---
3e5111
 src/qemu/qemu_hotplug.c | 6 +++---
3e5111
 1 file changed, 3 insertions(+), 3 deletions(-)
3e5111
3e5111
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
3e5111
index de561da58..b5b520d8c 100644
3e5111
--- a/src/qemu/qemu_hotplug.c
3e5111
+++ b/src/qemu/qemu_hotplug.c
3e5111
@@ -5784,7 +5784,7 @@ qemuDomainSetVcpuConfig(virDomainDefPtr def,
3e5111
 
3e5111
     def->individualvcpus = true;
3e5111
 
3e5111
-    while ((next = virBitmapNextSetBit(map, next)) > 0) {
3e5111
+    while ((next = virBitmapNextSetBit(map, next)) >= 0) {
3e5111
         if (!(vcpu = virDomainDefGetVcpu(def, next)))
3e5111
             continue;
3e5111
 
3e5111
@@ -5817,7 +5817,7 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr def,
3e5111
         return NULL;
3e5111
 
3e5111
     /* make sure that all selected vcpus are in the correct state */
3e5111
-    while ((next = virBitmapNextSetBit(map, next)) > 0) {
3e5111
+    while ((next = virBitmapNextSetBit(map, next)) >= 0) {
3e5111
         if (!(vcpu = virDomainDefGetVcpu(def, next)))
3e5111
             continue;
3e5111
 
3e5111
@@ -5837,7 +5837,7 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr def,
3e5111
     /* Make sure that all vCPUs belonging to a single hotpluggable entity were
3e5111
      * selected and then de-select any sub-threads of it. */
3e5111
     next = -1;
3e5111
-    while ((next = virBitmapNextSetBit(map, next)) > 0) {
3e5111
+    while ((next = virBitmapNextSetBit(map, next)) >= 0) {
3e5111
         if (!(vcpu = virDomainDefGetVcpu(def, next)))
3e5111
             continue;
3e5111
 
3e5111
-- 
3e5111
2.12.2
3e5111