Bug 905836 - $dom->get_vcpu_info() have some issues.
Summary: $dom->get_vcpu_info() have some issues.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: perl-Sys-Virt
Version: 6.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Daniel Berrangé
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-30 09:44 UTC by zhe peng
Modified: 2016-04-26 13:46 UTC (History)
6 users (show)

Fixed In Version: perl-Sys-Virt-0.10.2-6.el6
Doc Type: Bug Fix
Doc Text:
Previously, using the libvirt-tck utility to display virtual CPU (VCPU) information only printed a part of the expected diagnostics. With this update, the get_vcpu_info() function handles VCPU flags properly, and libvirt-tck displays the full extent of the expected information.
Clone Of:
: 994139 (view as bug list)
Environment:
Last Closed: 2015-07-22 07:24:32 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1387 normal SHIPPED_LIVE perl-Sys-Virt bug fix update 2015-07-20 17:58:14 UTC

Description zhe peng 2013-01-30 09:44:57 UTC
Description of problem:
When try to get vcpus info using libvirt-tck,hash can't have keys mentioned in man page(cpu,cpuTime,state)


Version-Release number of selected component (if applicable):
libvirt-0.10.2-17.el6.x86_64
perl-Sys-Virt-0.10.2-5.el6.x86_64
kernel-2.6.32-348.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.348.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1.in libvirt-tck script,added
.....
my @vcpuinfo = $dom->get_vcpu_info();
foreach my $info(@vcpuinfo){
      while ((my $key, my $value) = each %$info){    
     diag "$key => $value\n";
         }
     }
.....
Actual results:
only list below two keys and values for each vcpu, i set vcpus to 3
# number => 0
# affinity =>
# number => 1
# affinity =>
# number => 2
# affinity =>


Expected results:
per /usr/share/man/man3/Sys::Virt:domain.3pm.gz,
get_vcpu_info should have 'number,cpu,cpuTime,state,affinity'

Additional info:
using virsh cmd line,result as below:
# virsh vcpuinfo win2012
VCPU:           0
CPU:            2
State:          running
CPU time:       22780.5s
CPU Affinity:   yyyy

VCPU:           1
CPU:            0
State:          running
CPU Affinity:   yyyy

VCPU:           2
CPU:            0
State:          running
CPU Affinity:   yyyy

Comment 3 Daniel Berrangé 2013-08-06 14:52:10 UTC
commit f8514d9440ccc6827d6cb7d71e891fae10a26ad1
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Aug 6 15:46:02 2013 +0100

    Fix handling of flags in get_vcpu_info()
    
    We must always use virDomainGetVcpus if flags is zero and
    fall back to virDomainGetVcpuPinInfo if we get an error
    indicating the guest was shutoff.

Comment 6 zhe peng 2015-03-25 07:58:07 UTC
verify with build perl-Sys-Virt-0.10.2-6.el6.x86_64

step:
1: prepare a guest with 3 vcpus
2: write a script to print vcpu info
....
my @vcpuinfo = $dom->get_vcpu_info();
foreach my $info (@vcpuinfo){
print "  VCPU: {\n";
foreach (sort { $a cmp $b } keys %{$info}) {
if ($_ eq "affinity") {
print "    ", $_, ": ";
my @mask = split //, $info->{$_};
for (my $p = 0 ; $p < $nodeinfo->{cpus} ; $p++) {
                     print ((ord($mask[$p/8]) & (1 << ($p % 8))) ? 1 : 0);
                 }
print "\n";
             } else {
                 print "    ", $_, ": ", $info->{$_}, "\n";
             }
}
}
....

get result:
  VCPU: {
    affinity: 1111
    cpu: 0
    cpuTime: 40000000
    number: 0
    state: 1
  VCPU: {
    affinity: 1111
    cpu: 2
    cpuTime: 0
    number: 1
    state: 1
  VCPU: {
    affinity: 1111
    cpu: 1
    cpuTime: 0
    number: 2
    state: 1

 move to verified.

Comment 8 errata-xmlrpc 2015-07-22 07:24:32 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.

https://rhn.redhat.com/errata/RHBA-2015-1387.html


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