Blame SOURCES/libvirt-virsh-vcpuinfo-Report-vcpu-number-from-the-structure-rather-than-it-s-position.patch

6ae9ed
From 883b1800bf6c648abc0287c31421ce75342bb51c Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <883b1800bf6c648abc0287c31421ce75342bb51c@dist-git>
6ae9ed
From: Peter Krempa <pkrempa@redhat.com>
6ae9ed
Date: Fri, 26 Aug 2016 15:45:23 -0400
6ae9ed
Subject: [PATCH] virsh: vcpuinfo: Report vcpu number from the structure rather
6ae9ed
 than it's position
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
6ae9ed
6ae9ed
virVcpuInfo contains the vcpu number that the data refers to. Report
6ae9ed
what's returned by the daemon rather than the sequence number as with
6ae9ed
sparse vcpu topologies they won't match.
6ae9ed
6ae9ed
(cherry picked from commit 64f26276bfb2c4c01a3fc007e5449c9ca3d93de2)
6ae9ed
---
6ae9ed
 tools/virsh-domain.c | 3 ++-
6ae9ed
 1 file changed, 2 insertions(+), 1 deletion(-)
6ae9ed
6ae9ed
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
6ae9ed
index dbdee5b..c820f60 100644
6ae9ed
--- a/tools/virsh-domain.c
6ae9ed
+++ b/tools/virsh-domain.c
6ae9ed
@@ -6315,8 +6315,8 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
6ae9ed
     }
6ae9ed
 
6ae9ed
     for (n = 0; n < ncpus; n++) {
6ae9ed
-        vshPrint(ctl, "%-15s %d\n", _("VCPU:"), n);
6ae9ed
         if (cpuinfo) {
6ae9ed
+            vshPrint(ctl, "%-15s %d\n", _("VCPU:"), cpuinfo[n].number);
6ae9ed
             vshPrint(ctl, "%-15s %d\n", _("CPU:"), cpuinfo[n].cpu);
6ae9ed
             vshPrint(ctl, "%-15s %s\n", _("State:"),
6ae9ed
                      virshDomainVcpuStateToString(cpuinfo[n].state));
6ae9ed
@@ -6328,6 +6328,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
6ae9ed
                 vshPrint(ctl, "%-15s %.1lfs\n", _("CPU time:"), cpuUsed);
6ae9ed
             }
6ae9ed
         } else {
6ae9ed
+            vshPrint(ctl, "%-15s %d\n", _("VCPU:"), n);
6ae9ed
             vshPrint(ctl, "%-15s %s\n", _("CPU:"), _("N/A"));
6ae9ed
             vshPrint(ctl, "%-15s %s\n", _("State:"), _("N/A"));
6ae9ed
             vshPrint(ctl, "%-15s %s\n", _("CPU time"), _("N/A"));
6ae9ed
-- 
6ae9ed
2.10.0
6ae9ed