Bug 800366

Summary: libvirt does not report the system and user cpu usage separately for vms.
Product: Red Hat Enterprise Linux 6 Reporter: Yaniv Lavi <ylavi>
Component: libvirtAssignee: Gunannan Ren <gren>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2CC: acathrow, dallan, dyuan, eblake, gsun, mzhan, rwu, veillard, whuang, yupzhang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.10-7.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 800367 (view as bug list) Environment:
Last Closed: 2012-06-20 06:49:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 800367, 800372    

Description Yaniv Lavi 2012-03-06 12:02:45 UTC
Description of problem:
In RHEVM 3.0 the history database vm system cpu usage is always 0. This is because libvirt do not report the system and user cpu usage separately and vdsm send all the vm cpu usage as user cpu only. Need to add this separation.

Comment 2 Yaniv Lavi 2012-03-06 12:50:55 UTC
System usage is an important statistic to troubleshoot various performance
related problems. So i think it's very important to have this.

Comment 3 Eric Blake 2012-03-09 17:37:46 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2012-March/msg00404.html

Comment 7 Daniel Veillard 2012-03-13 09:04:12 UTC
Note that the C API part is now included in libvirt-0.9.10-5.el6
but the bug is not finished as the python bindings are still missing

Daniel

Comment 8 Gunannan Ren 2012-03-14 06:03:27 UTC
Upstream patch sent:
https://www.redhat.com/archives/libvir-list/2012-March/msg00583.html

Comment 12 Wayne Sun 2012-03-28 06:22:24 UTC
packages:
libvirt-0.9.10-8.el6.x86_64
qemu-kvm-0.12.1.2-2.265.el6rhev.x86_64
kernel-2.6.32-251.el6.x86_64
libvirt-python-0.9.10-8.el6.x86_64

steps:
1. prepare a running domain
2. check with python

# python
Python 2.6.6 (r266:84292, Sep 12 2011, 14:03:14) 
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open(None)
>>> dom = conn.lookupByName("rhel6u2")
>>> dom.getCPUStats(True, 0)
[{'cpu_time': 31014583290L, 'system_time': 11450000000L, 'user_time': 1210000000L}]
>>> dom.getCPUStats(False, 0)
[{'cpu_time': 15015195428L}, {'cpu_time': 11334981960L}, {'cpu_time': 2948233412L}, {'cpu_time': 1722428230L}]

3. check with virsh
# virsh cpu-stats rhel6u2 --total --start 0 --count 4
CPU0:
	cpu_time            15.321903938 seconds
CPU1:
	cpu_time            11.410812819 seconds
CPU2:
	cpu_time             2.948269295 seconds
CPU3:
	cpu_time             1.724287630 seconds
Total:
	cpu_time            31.405273682 seconds
	user_time            1.310000000 seconds
	system_time         12.860000000 seconds

Comment 14 errata-xmlrpc 2012-06-20 06:49:42 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/RHSA-2012-0748.html