]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: vcpuinfo: Report vcpu number from the structure rather than it's position
authorPeter Krempa <pkrempa@redhat.com>
Thu, 25 Aug 2016 18:48:52 +0000 (14:48 -0400)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 26 Aug 2016 15:23:00 +0000 (11:23 -0400)
virVcpuInfo contains the vcpu number that the data refers to. Report
what's returned by the daemon rather than the sequence number as with
sparse vcpu topologies they won't match.

tools/virsh-domain.c

index de2a22c0597cff9e83f3fa1baa0d26939fac8695..90d2543c9bf9b04e0c0bc8bcdae6dd2943a76c62 100644 (file)
@@ -6315,8 +6315,8 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
     }
 
     for (n = 0; n < ncpus; n++) {
-        vshPrint(ctl, "%-15s %d\n", _("VCPU:"), n);
         if (cpuinfo) {
+            vshPrint(ctl, "%-15s %d\n", _("VCPU:"), cpuinfo[n].number);
             vshPrint(ctl, "%-15s %d\n", _("CPU:"), cpuinfo[n].cpu);
             vshPrint(ctl, "%-15s %s\n", _("State:"),
                      virshDomainVcpuStateToString(cpuinfo[n].state));
@@ -6328,6 +6328,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
                 vshPrint(ctl, "%-15s %.1lfs\n", _("CPU time:"), cpuUsed);
             }
         } else {
+            vshPrint(ctl, "%-15s %d\n", _("VCPU:"), n);
             vshPrint(ctl, "%-15s %s\n", _("CPU:"), _("N/A"));
             vshPrint(ctl, "%-15s %s\n", _("State:"), _("N/A"));
             vshPrint(ctl, "%-15s %s\n", _("CPU time"), _("N/A"));