Bug 882831 - virsh cpu-stats return cpuacct parse error with --start option
Summary: virsh cpu-stats return cpuacct parse error with --start option
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Gunannan Ren
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-03 08:16 UTC by yanbing du
Modified: 2014-06-18 00:43 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.0.3-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 11:23:55 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description yanbing du 2012-12-03 08:16:42 UTC
Description of problem:
virsh cpu-stats can show the domain cpu statistics. But if use --start option, it
will get cpuacct parse error, and if both use --start and --count options, the 
result will be correct.

Version-Release number of selected component (if applicable):
libvirt-1.0.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Start a guest.

2.
# virsh  cpu-stats guest 
CPU0:
        cpu_time             5.811488724 seconds
        vcpu_time            4.124984287 seconds
CPU1:
        cpu_time             1.453247171 seconds
        vcpu_time            1.403228135 seconds
CPU2:
        cpu_time             0.000300890 seconds
        vcpu_time            0.000000000 seconds
CPU3:
        cpu_time             0.122012319 seconds
        vcpu_time            0.121316171 seconds
CPU4:
        cpu_time            14.183166346 seconds
        vcpu_time           13.095179971 seconds
CPU5:
        cpu_time             1.533865480 seconds
        vcpu_time            1.332197471 seconds
CPU6:
        cpu_time             0.010637086 seconds
        vcpu_time            0.000000000 seconds
CPU7:
        cpu_time             0.006461043 seconds
        vcpu_time            0.000876137 seconds
CPU8:
        cpu_time            10.824887717 seconds
        vcpu_time            9.883035525 seconds
CPU9:
        cpu_time             1.685738118 seconds
        vcpu_time            1.486312802 seconds
CPU10:
        cpu_time             0.009727880 seconds
        vcpu_time            0.000000000 seconds
CPU11:
        cpu_time             0.004893243 seconds
        vcpu_time            0.000000000 seconds
CPU12:
        cpu_time            12.755546579 seconds
        vcpu_time           11.462028684 seconds
CPU13:
        cpu_time            13.518863915 seconds
        vcpu_time           13.486692722 seconds
CPU14:
        cpu_time             0.000537976 seconds
        vcpu_time            0.000000000 seconds
CPU15:
        cpu_time             0.248868721 seconds
        vcpu_time            0.248676629 seconds
Total:
        cpu_time            62.170243208 seconds
        user_time            5.440000000 seconds
        system_time         33.760000000 seconds

If --start=0, the result is correct, if this value greater than 0,
it will return error:

# virsh  cpu-stats guest --start 1
error: Failed to virDomainGetCPUStats()

error: internal error cpuacct parse error

If use --start and --count, the result is correct:

# virsh  cpu-stats guest --start 1 --count 1
CPU1:
        cpu_time             1.478101191 seconds
        vcpu_time            1.428082155 seconds


  
Actual results:
This option failed.

Expected results:
It can return the expect result.

Additional info:

Comment 1 Gunannan Ren 2013-02-20 11:45:47 UTC
patch sent to upstream
https://www.redhat.com/archives/libvir-list/2013-February/msg01101.html

Comment 2 Gunannan Ren 2013-02-21 03:19:33 UTC
commit 091831633f91009379ff9daf2dc98f917aefa12f
Author: Guannan Ren <gren@redhat.com>
Date:   Wed Feb 20 19:28:13 2013 +0800

    qemu: fix an off-by-one error in qemuDomainGetPercpuStats
    
    The max value of number of cpus to compute(id) should not
    be equal or greater than max cpu number.
    The bug ocurrs when id value is equal to max cpu number which
    leads to the off-by-one error in the following for loop.
    
     # virsh  cpu-stats guest --start 1
     error: Failed to virDomainGetCPUStats()
    
     error: internal error cpuacct parse error

Comment 3 Wayne Sun 2013-03-07 03:13:05 UTC
pkgs:
libvirt-1.0.3-1.el7.x86_64
qemu-kvm-1.3.0-5.el7.x86_64
kernel-3.8.0-0.38.el7.x86_64


steps:

# for i in {0..16}; do echo "############## "$i" #############"; virsh cpu-stats demo --start $i; done
############## 0 #############
CPU0:
	cpu_time            10.750013952 seconds
	vcpu_time            0.153921391 seconds
CPU1:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds
CPU2:
	cpu_time             0.002319220 seconds
	vcpu_time            0.001678261 seconds
CPU3:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds
CPU4:
	cpu_time            67.009878738 seconds
	vcpu_time           67.009878738 seconds
CPU5:
	cpu_time             0.000966815 seconds
	vcpu_time            0.000921314 seconds
CPU6:
	cpu_time             0.002436784 seconds
	vcpu_time            0.000350037 seconds
CPU7:
	cpu_time             0.021225485 seconds
	vcpu_time            0.000000000 seconds
CPU8:
	cpu_time             1.886871216 seconds
	vcpu_time            1.886256420 seconds
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 1 #############
CPU1:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds
CPU2:
	cpu_time             0.002319220 seconds
	vcpu_time            0.001678261 seconds
CPU3:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds
CPU4:
	cpu_time            67.009969579 seconds
	vcpu_time           67.009969579 seconds
CPU5:
	cpu_time             0.000966815 seconds
	vcpu_time            0.000921314 seconds
CPU6:
	cpu_time             0.002436784 seconds
	vcpu_time            0.000350037 seconds
CPU7:
	cpu_time             0.021225485 seconds
	vcpu_time            0.000000000 seconds
CPU8:
	cpu_time             1.886871216 seconds
	vcpu_time            1.886256420 seconds
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 2 #############
CPU2:
	cpu_time             0.002319220 seconds
	vcpu_time            0.001678261 seconds
CPU3:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds
CPU4:
	cpu_time            67.009969579 seconds
	vcpu_time           67.009969579 seconds
CPU5:
	cpu_time             0.000966815 seconds
	vcpu_time            0.000921314 seconds
CPU6:
	cpu_time             0.002436784 seconds
	vcpu_time            0.000350037 seconds
CPU7:
	cpu_time             0.021225485 seconds
	vcpu_time            0.000000000 seconds
CPU8:
	cpu_time             1.886871216 seconds
	vcpu_time            1.886256420 seconds
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 3 #############
CPU3:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds
CPU4:
	cpu_time            67.009969579 seconds
	vcpu_time           67.009969579 seconds
CPU5:
	cpu_time             0.000966815 seconds
	vcpu_time            0.000921314 seconds
CPU6:
	cpu_time             0.002436784 seconds
	vcpu_time            0.000350037 seconds
CPU7:
	cpu_time             0.021225485 seconds
	vcpu_time            0.000000000 seconds
CPU8:
	cpu_time             1.886871216 seconds
	vcpu_time            1.886256420 seconds
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 4 #############
CPU4:
	cpu_time            67.010042288 seconds
	vcpu_time           67.010042288 seconds
CPU5:
	cpu_time             0.000966815 seconds
	vcpu_time            0.000921314 seconds
CPU6:
	cpu_time             0.002436784 seconds
	vcpu_time            0.000350037 seconds
CPU7:
	cpu_time             0.021225485 seconds
	vcpu_time            0.000000000 seconds
CPU8:
	cpu_time             1.886871216 seconds
	vcpu_time            1.886256420 seconds
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 5 #############
CPU5:
	cpu_time             0.000966815 seconds
	vcpu_time            0.000921314 seconds
CPU6:
	cpu_time             0.002436784 seconds
	vcpu_time            0.000350037 seconds
CPU7:
	cpu_time             0.021225485 seconds
	vcpu_time            0.000000000 seconds
CPU8:
	cpu_time             1.886871216 seconds
	vcpu_time            1.886256420 seconds
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 6 #############
CPU6:
	cpu_time             0.002436784 seconds
	vcpu_time            0.000350037 seconds
CPU7:
	cpu_time             0.021225485 seconds
	vcpu_time            0.000000000 seconds
CPU8:
	cpu_time             1.886871216 seconds
	vcpu_time            1.886256420 seconds
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 7 #############
CPU7:
	cpu_time             0.021225485 seconds
	vcpu_time            0.000000000 seconds
CPU8:
	cpu_time             1.886871216 seconds
	vcpu_time            1.886256420 seconds
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 8 #############
CPU8:
	cpu_time             1.886871216 seconds
	vcpu_time            1.886256420 seconds
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 9 #############
CPU9:
	cpu_time             0.026243930 seconds
	vcpu_time            0.000000000 seconds
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 10 #############
CPU10:
	cpu_time             0.000562834 seconds
	vcpu_time            0.000000000 seconds
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 11 #############
CPU11:
	cpu_time             0.000080018 seconds
	vcpu_time            0.000000000 seconds
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 12 #############
CPU12:
	cpu_time             1.029686845 seconds
	vcpu_time            1.029035864 seconds
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 13 #############
CPU13:
	cpu_time             0.028028862 seconds
	vcpu_time            0.000000000 seconds
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 14 #############
CPU14:
	cpu_time             0.000328048 seconds
	vcpu_time            0.000000000 seconds
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 15 #############
CPU15:
	cpu_time             0.000000000 seconds
	vcpu_time            0.000000000 seconds

############## 16 #############


also reproduced on libvirt-1.0.2-1.el7.x86_64, so this is fixed.

Comment 4 Ludek Smid 2014-06-13 11:23:55 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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