
On 01/14/2014 09:40 PM, Daniel P. Berrange wrote:
On Mon, Jan 13, 2014 at 06:28:07PM +0800, mars@linux.vnet.ibm.com wrote:
From: Bing Bu Cao <mars@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@linux.vnet.ibm.com> Signed-off-by: Pradipta Kr. Banerjee <bpradip@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. I found there is no test case for linuxNodeGetCPUStats() right now, it is 'static' there. I think adding a new test case to validate linuxNodeGetCPUStats() should not only cover this patch.
What do you think posting another patch to adding the test case?
Daniel
-- Best Regards, Bing Bu Cao