[PATCH 1/6] virsh: vcpuinfo: Report vcpu number from the structure rather than it's position

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index de2a22c..90d2543 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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"));
-- 
2.8.2

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]