RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 861581 - [perl-Sys-Virt] error of get_node_cpu_stats and get_node_memory_stats
Summary: [perl-Sys-Virt] error of get_node_cpu_stats and get_node_memory_stats
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: perl-Sys-Virt
Version: 6.4
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Daniel Berrangé
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-29 09:29 UTC by weizhang
Modified: 2016-04-26 13:36 UTC (History)
2 users (show)

Fixed In Version: perl-Sys-Virt-0.10.2-3.el6
Doc Type: Bug Fix
Doc Text:
Cause: The incorrect string length was used when setting hash keys Consequence: The name of some hash keys was truncated Fix: The correct string lengths were provided for hash keys Result: The hash keys for the get_node_memory_stats API match their documentation
Clone Of:
Environment:
Last Closed: 2013-02-21 09:52:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0377 0 normal SHIPPED_LIVE perl-Sys-Virt bug fix and enhancement update 2013-02-20 20:52:18 UTC

Description weizhang 2012-09-29 09:29:25 UTC
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:

Comment 1 Dave Allan 2012-10-02 16:30:44 UTC
Dan, is utilization available in the latest build?

Comment 2 Daniel Berrangé 2012-10-04 08:30:24 UTC
This isn't a bug - the exact set of fields provided varies per hypervisor.

Comment 3 Dave Allan 2012-10-04 21:07:25 UTC
Ok, I'm closing it.

Comment 4 weizhang 2012-10-08 03:13:34 UTC
(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?

Comment 5 Daniel Berrangé 2012-10-12 08:06:48 UTC
Both of these problems are bugs - the wrong length was used when setting the hash key names

Comment 7 weizhang 2012-10-15 03:44:53 UTC
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?

Comment 8 Daniel Berrangé 2012-10-15 14:27:38 UTC
Oh yes, that is a docs bug still.

Comment 9 Daniel Berrangé 2012-10-15 15:36:31 UTC
Latest build has the docs fixed

Comment 10 weizhang 2012-10-16 08:25:14 UTC
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

Comment 12 errata-xmlrpc 2013-02-21 09:52:22 UTC
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


Note You need to log in before you can comment on or make changes to this bug.