Description of problem: According to the doc, get_node_cpu_stats returned hash key are kernel The time spent in kernelspace user The time spent in userspace idle The idle time iowait The I/O wait time utilization The overall percentage utilization. but for the test it only list first 4 without "utilization" and according to the doc, get_node_memory_stats returned hash reference are total The total memory free The free memory buffers The memory consumed by buffers cache The memory consumed for cache But in fact the retured hash is buff, free, total and cached, so need to change doc And when getting total with \ $con->get_node_memory_stats()->{total}; It can not get any value, but when print all keys and values, the total value can be list. Others in get_node_memory_stats are ok Version-Release number of selected component (if applicable): perl-Sys-Virt-0.10.2-1.el6.x86_64 How reproducible: 100% Steps to Reproduce: 1. cat perl.pl #!/usr/bin/perl use warnings; use strict; use Sys::Virt; my $uri = "qemu:///system"; my $con = Sys::Virt->new(address => $uri, readonly => 0); my $cpu_stats = $con->get_node_cpu_stats(); while( my ($c, $d) = each %{$cpu_stats}) { print "$c => $d\n"; } print "\n"; my $memory_stats = $con->get_node_memory_stats(); while( my ($a, $b) = each %{$memory_stats}) { print "$a => $b\n"; } print "\n"; my $memory_state_total = $con->get_node_memory_stats()->{total}; print "memory state total is $memory_state_total\n"; 2. # perl perl.pl 3. # man /usr/share/man/man3/Sys::Virt.3pm.gz Actual results: can not get utilization and total value Expected results: can get total value and move utilization in doc Additional info:
Dan, is utilization available in the latest build?
This isn't a bug - the exact set of fields provided varies per hypervisor.
Ok, I'm closing it.
(In reply to comment #0) > and according to the doc, get_node_memory_stats returned hash reference are > > total > The total memory > > free > The free memory > > buffers > The memory consumed by buffers > > cache > The memory consumed for cache > > But in fact the retured hash is buff, free, total and cached, so need to > change doc > And when getting total with \ > $con->get_node_memory_stats()->{total}; > > It can not get any value, but when print all keys and values, the total > value can be list. Others in get_node_memory_stats are ok > Hi DB, What about this 2 problem? Are they also not bugs?
Both of these problems are bugs - the wrong length was used when setting the hash key names
Test on perl-Sys-Virt-0.10.2-2.el6.x86_64 According to the doc, get_node_memory_stats returned hash reference are total The total memory free The free memory buffers The memory consumed by buffers cache The memory consumed for cache Test result for script list in description for get_node_memory_stats buffers => 20552 free => 3797896 total => 8060676 cached => 427700 memory state total is 8060676 Only a small problem, the doc is cache, and the list result is cached, is that need to be fixed again or just leave it?
Oh yes, that is a docs bug still.
Latest build has the docs fixed
verify pass on perl-Sys-Virt-0.10.2-3.el6.x86_64 # cat perl-bug861581.pl #!/usr/bin/perl use warnings; use strict; use Sys::Virt; my $uri = "qemu:///system"; my $con = Sys::Virt->new(address => $uri, readonly => 0); my $memory_stats = $con->get_node_memory_stats(); while( my ($a, $b) = each %{$memory_stats}) { print "$a => $b\n"; } my $memory_state_total = $con->get_node_memory_stats()->{total}; print "memory state total is $memory_state_total\n"; # perl perl-bug861581.pl Result buffers => 35804 free => 6056976 total => 8060732 cached => 499232 memory state total is 8060732 And in doc my $info = $con->get_node_memory_stats($cellNum=-1, $flags=0) The fields in the returned hash reference are total The total memory free The free memory buffers The memory consumed by buffers cached The memory consumed for cache
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-0377.html