9119d9
From 9b04043536c8d36d6b777612c8050f8c722dfc8e Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <9b04043536c8d36d6b777612c8050f8c722dfc8e@dist-git>
9119d9
From: Francesco Romani <fromani@redhat.com>
9119d9
Date: Wed, 1 Oct 2014 11:20:17 +0200
9119d9
Subject: [PATCH] virsh: add options to query bulk stats group
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1113116
9119d9
9119d9
Add new bulk stats groups to the domstats command.
9119d9
9119d9
Signed-off-by: Francesco Romani <fromani@redhat.com>
9119d9
(cherry picked from commit 1db475650a0fb6ebf4ac62a5067f10905319e313)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 tools/virsh-domain-monitor.c | 35 +++++++++++++++++++++++++++++++++++
9119d9
 tools/virsh.pod              |  4 +++-
9119d9
 2 files changed, 38 insertions(+), 1 deletion(-)
9119d9
9119d9
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
9119d9
index 055d8d2..d013ca8 100644
9119d9
--- a/tools/virsh-domain-monitor.c
9119d9
+++ b/tools/virsh-domain-monitor.c
9119d9
@@ -1972,6 +1972,26 @@ static const vshCmdOptDef opts_domstats[] = {
9119d9
      .type = VSH_OT_BOOL,
9119d9
      .help = N_("report domain state"),
9119d9
     },
9119d9
+    {.name = "cpu-total",
9119d9
+     .type = VSH_OT_BOOL,
9119d9
+     .help = N_("report domain physical cpu usage"),
9119d9
+    },
9119d9
+    {.name = "balloon",
9119d9
+     .type = VSH_OT_BOOL,
9119d9
+     .help = N_("report domain balloon statistics"),
9119d9
+    },
9119d9
+    {.name = "vcpu",
9119d9
+     .type = VSH_OT_BOOL,
9119d9
+     .help = N_("report domain virtual cpu information"),
9119d9
+    },
9119d9
+    {.name = "interface",
9119d9
+     .type = VSH_OT_BOOL,
9119d9
+     .help = N_("report domain network interface information"),
9119d9
+    },
9119d9
+    {.name = "block",
9119d9
+     .type = VSH_OT_BOOL,
9119d9
+     .help = N_("report domain block device statistics"),
9119d9
+    },
9119d9
     {.name = "list-active",
9119d9
      .type = VSH_OT_BOOL,
9119d9
      .help = N_("list only active domains"),
9119d9
@@ -2063,6 +2083,21 @@ cmdDomstats(vshControl *ctl, const vshCmd *cmd)
9119d9
     if (vshCommandOptBool(cmd, "state"))
9119d9
         stats |= VIR_DOMAIN_STATS_STATE;
9119d9
 
9119d9
+    if (vshCommandOptBool(cmd, "cpu-total"))
9119d9
+        stats |= VIR_DOMAIN_STATS_CPU_TOTAL;
9119d9
+
9119d9
+    if (vshCommandOptBool(cmd, "balloon"))
9119d9
+        stats |= VIR_DOMAIN_STATS_BALLOON;
9119d9
+
9119d9
+    if (vshCommandOptBool(cmd, "vcpu"))
9119d9
+        stats |= VIR_DOMAIN_STATS_VCPU;
9119d9
+
9119d9
+    if (vshCommandOptBool(cmd, "interface"))
9119d9
+        stats |= VIR_DOMAIN_STATS_INTERFACE;
9119d9
+
9119d9
+    if (vshCommandOptBool(cmd, "block"))
9119d9
+        stats |= VIR_DOMAIN_STATS_BLOCK;
9119d9
+
9119d9
     if (vshCommandOptBool(cmd, "list-active"))
9119d9
         flags |= VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE;
9119d9
 
9119d9
diff --git a/tools/virsh.pod b/tools/virsh.pod
9119d9
index 0f5523f..ea96d64 100644
9119d9
--- a/tools/virsh.pod
9119d9
+++ b/tools/virsh.pod
9119d9
@@ -814,6 +814,7 @@ I<snapshot-create> for disk snapshots) will accept either target
9119d9
 or unique source names printed by this command.
9119d9
 
9119d9
 =item B<domstats> [I<--raw>] [I<--enforce>] [I<--state>]
9119d9
+[I<--cpu-total>] [I<--balloon>] [I<--vcpu>] [I<--interface>] [I<--block>]
9119d9
 [[I<--list-active>] [I<--list-inactive>] [I<--list-persistent>]
9119d9
 [I<--list-transient>] [I<--list-running>] [I<--list-paused>]
9119d9
 [I<--list-shutoff>] [I<--list-other>]] | [I<domain> ...]
9119d9
@@ -831,7 +832,8 @@ behavior use the I<--raw> flag.
9119d9
 
9119d9
 The individual statistics groups are selectable via specific flags. By
9119d9
 default all supported statistics groups are returned. Supported
9119d9
-statistics groups flags are: I<--state>.
9119d9
+statistics groups flags are: I<--state>, I<--cpu-total>, I<--balloon>,
9119d9
+I<--vcpu>, I<--interface>, I<--block>.
9119d9
 
9119d9
 Selecting a specific statistics groups doesn't guarantee that the
9119d9
 daemon supports the selected group of stats. Flag I<--enforce>
9119d9
-- 
9119d9
2.1.2
9119d9