[libvirt] [PATCH 11/12] [v2] virNodeGetMemoryStats: Implement virsh support

Eric Blake eblake at redhat.com
Tue Jun 14 22:37:41 UTC 2011


On 06/14/2011 03:19 AM, Daniel P. Berrange wrote:
> On Tue, Jun 07, 2011 at 10:09:15AM +0900, Minoru Usui wrote:
>> virNodeGetMemoryStats: Implement virsh support
>>
>> Signed-off-by: Minoru Usui <usui at mxm.nes.nec.co.jp>
>> ---
>>  tools/virsh.c   |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  tools/virsh.pod |    5 ++++
>>  2 files changed, 67 insertions(+), 0 deletions(-)
>>

>> + * "nodememstats" command
>> + */
>> +static const vshCmdInfo info_nodememstats[] = {
>> +    {"help", N_("Prints memory stats of the node.")},
>> +    {"desc", N_("Returns memory stats of the node.(KB)")},

Ah, the (nsec) in the previous patch was for the units.  I'll make that
more clear.

>> +static bool
>> +cmdNodememstats(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)

This naming is odd; I went with cmdNodeMemStats.  Also, cmd is used, and
style says no space between * and cmd in a declaration.

>> +=item B<nodememstats> optional I<--cell>

<cell>, not <--cell>.

>> +
>> +Returns memory stats of the node.
>> +If I<--cell> is specified, this will prints specified cell statistics only.
>> +
>>  =item B<capabilities>
>>  
>>  Print an XML document describing the capabilities of the hypervisor
> 
> ACK

I squashed this in before pushing:

diff --git i/tools/virsh.c w/tools/virsh.c
index a63734f..4b6b8ba 100644
--- i/tools/virsh.c
+++ w/tools/virsh.c
@@ -3718,7 +3718,7 @@ cmdNodeinfo(vshControl *ctl, const vshCmd *cmd
ATTRIBUTE_UNUSED)
  */
 static const vshCmdInfo info_nodecpustats[] = {
     {"help", N_("Prints cpu stats of the node.")},
-    {"desc", N_("Returns cpu stats of the node.")},
+    {"desc", N_("Returns cpu stats of the node, in nanoseconds.")},
     {NULL, NULL}
 };

@@ -3729,7 +3729,7 @@ static const vshCmdOptDef opts_node_cpustats[] = {
 };

 static bool
-cmdNodeCPUStats(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
+cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
 {
     int i, j;
     bool flag_utilization = false;
@@ -3847,7 +3847,7 @@ cmdNodeCPUStats(vshControl *ctl, const vshCmd *cmd
ATTRIBUTE_UNUSED)
  */
 static const vshCmdInfo info_nodememstats[] = {
     {"help", N_("Prints memory stats of the node.")},
-    {"desc", N_("Returns memory stats of the node.(KB)")},
+    {"desc", N_("Returns memory stats of the node, in kilobytes.")},
     {NULL, NULL}
 };

@@ -3857,7 +3857,7 @@ static const vshCmdOptDef opts_node_memstats[] = {
 };

 static bool
-cmdNodememstats(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd)
 {
     int nparams = 0;
     unsigned int i = 0;
@@ -11583,9 +11583,9 @@ static const vshCmdDef hostAndHypervisorCmds[] = {
      VSH_CMD_FLAG_NOCONNECT},
     {"freecell", cmdFreecell, opts_freecell, info_freecell, 0},
     {"hostname", cmdHostname, NULL, info_hostname, 0},
-    {"nodecpustats", cmdNodeCPUStats, opts_node_cpustats,
info_nodecpustats, 0},
+    {"nodecpustats", cmdNodeCpuStats, opts_node_cpustats,
info_nodecpustats, 0},
     {"nodeinfo", cmdNodeinfo, NULL, info_nodeinfo, 0},
-    {"nodememstats", cmdNodememstats, opts_node_memstats,
info_nodememstats, 0},
+    {"nodememstats", cmdNodeMemStats, opts_node_memstats,
info_nodememstats, 0},
     {"qemu-monitor-command", cmdQemuMonitorCommand,
opts_qemu_monitor_command,
      info_qemu_monitor_command, 0},
     {"sysinfo", cmdSysinfo, NULL, info_sysinfo, 0},
diff --git i/tools/virsh.pod w/tools/virsh.pod
index b5ea174..c3f521a 100644
--- i/tools/virsh.pod
+++ w/tools/virsh.pod
@@ -246,10 +246,10 @@ If I<cpu> is specified, this will prints specified
cpu statistics only.
 If I<--percent> is specified, this will prints percentage of each kind
of cpu
 statistics during 1 second.

-=item B<nodememstats> optional I<--cell>
+=item B<nodememstats> optional I<cell>

 Returns memory stats of the node.
-If I<--cell> is specified, this will prints specified cell statistics only.
+If I<cell> is specified, this will prints specified cell statistics only.

 =item B<capabilities>


-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110614/9e868f0d/attachment-0001.sig>


More information about the libvir-list mailing list