[PATCH] Pass the correct cpu count when calling virDomainGetCPUStats.

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

 



When using the --start option, the show_count should not be set to
max_id as the --start <cpu> means we dont need those many inital cpu
stats. Hence, show_count should be adjusted accordingly.

Signed-off-by: Nitesh Konkar <nitkon12@xxxxxxxxxxxxxxxxxx>
---
Before Patch:
virsh cpu-stats --domain 24 --start 158
CPU158:
cpu_time             0.073570788 seconds
vcpu_time            0.033277032 seconds

CPU159:
cpu_time             0.000000000 seconds
vcpu_time            0.000000000 seconds
error: Failed to retrieve CPU statistics for domain 24
error: invalid argument: start_cpu 280 larger than maximum of 159

After Patch:
virsh cpu-stats --domain 24 --start 158
CPU158:
cpu_time             0.073570788 seconds
vcpu_time            0.033277032 seconds

CPU159:
cpu_time             0.000000000 seconds
vcpu_time            0.000000000 seconds

 tools/virsh-domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index bb1ee1c..7599bdc 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -7331,7 +7331,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
     if (show_count < 0 || show_count > max_id) {
         if (show_count > max_id)
             vshPrint(ctl, _("Only %d CPUs available to show\n"), max_id);
-        show_count = max_id;
+        show_count = max_id - cpu;
     }
 
     /* get percpu information */
-- 
1.8.3.1

--
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]