[libvirt] [PATCH] qemu: hotplug: print correct vcpu when validating hot(un)plug config

Peter Krempa posted 1 patch 8 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cc553508847537bbfbbca6261661957dfeb8c092.1494604184.git.pkrempa@redhat.com
src/qemu/qemu_hotplug.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
[libvirt] [PATCH] qemu: hotplug: print correct vcpu when validating hot(un)plug config
Posted by Peter Krempa 8 years ago
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 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e8d29186e..1d7f2cc71 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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;
         }
     }
-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: hotplug: print correct vcpu when validating hot(un)plug config
Posted by Ján Tomko 7 years, 12 months ago
On Fri, May 12, 2017 at 05:49:44PM +0200, Peter Krempa wrote:
>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 | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>

ACK

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list