From d9a0a885e2b1cf3c9fc5260f9cdf4fc8a768f26c Mon Sep 17 00:00:00 2001
From: Nitesh Konkar <niteshkonkar.libvirt@gmail.com>
Date: Fri, 1 Apr 2016 02:05:04 -0400
Subject: [PATCH] Pass the correct cpu count when calling virDomainGetCPUStats.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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 initial cpu
stats. Hence, show_count should be adjusted accordingly.

https://bugzilla.redhat.com/show_bug.cgi?id=1249441

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 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 d0d2dd08d9..36d0353fdf 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -7360,7 +7360,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 */
-- 
GitLab