[libvirt] [PATCH] virsh nodecpustats returns incorrect stats of cpu on Linux when the number of online cpu exceed 9.

Daniel P. Berrange berrange at redhat.com
Tue Jan 14 13:40:09 UTC 2014


On Mon, Jan 13, 2014 at 06:28:07PM +0800, mars at linux.vnet.ibm.com wrote:
> From: Bing Bu Cao <mars at linux.vnet.ibm.com>
> 
> To retrieve node cpu statistics on Linux system, the
> linuxNodeGetCPUstats function use STRPREFIX() to match the
> cpuid with the cpuid read from /proc/cpustat, it will cause
> obvious error.
> 
> For example:
> 'virsh nodecpustats 12' will display stats of cpu1 if the latter is online.
> 
> This patch fixes this bug.
> 
> Signed-off-by: Bing Bu Cao <mars at linux.vnet.ibm.com>
> Signed-off-by: Pradipta Kr. Banerjee <bpradip at in.ibm.com>
> ---
>  src/nodeinfo.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)

Can you also provide a test case to validate this. You just
need to get a suitable /proc/cpustat file and save it in the
tests/ dir and then include linuxNodeGetCPUStats() using that
file.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list