[libvirt] [PATCH] qemu: bulk stats: add pcpu placement information

This patch adds the information about the physical cpu placement of virtual cpus for bulk stats. This is the only difference in output with the virDomainGetVcpus() API. Management software, like oVirt, needs this information to properly manage NUMA configurations. Signed-off-by: Francesco Romani <fromani@redhat.com> --- src/libvirt-domain.c | 2 ++ src/qemu/qemu_driver.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index cb76d8c..63fc967 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -10888,6 +10888,8 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * from virVcpuState enum. * "vcpu.<num>.time" - virtual cpu time spent by virtual CPU <num> * as unsigned long long. + * "vcpu.<num>.physical" - real CPU number on which virtual CPU <num> is + * running, or -1 if offline. * * VIR_DOMAIN_STATS_INTERFACE: Return network interface statistics. * The typed parameter keys are in this format: diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 830fca7..ab0652d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18348,6 +18348,15 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, param_name, cpuinfo[i].cpuTime) < 0) goto cleanup; + + snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, + "vcpu.%zu.physical", i); + if (virTypedParamsAddULLong(&record->params, + &record->nparams, + maxparams, + param_name, + cpuinfo[i].cpu) < 0) + goto cleanup; } ret = 0; -- 1.9.3

On 12/10/2014 05:39 AM, Francesco Romani wrote:
This patch adds the information about the physical cpu placement of virtual cpus for bulk stats.
This is the only difference in output with the virDomainGetVcpus() API. Management software, like oVirt, needs this information to properly manage NUMA configurations.
Signed-off-by: Francesco Romani <fromani@redhat.com> ---
+++ b/src/libvirt-domain.c @@ -10888,6 +10888,8 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * from virVcpuState enum. * "vcpu.<num>.time" - virtual cpu time spent by virtual CPU <num> * as unsigned long long. + * "vcpu.<num>.physical" - real CPU number on which virtual CPU <num> is + * running, or -1 if offline.
As which type?
+ if (virTypedParamsAddULLong(&record->params, + &record->nparams, + maxparams, + param_name, + cpuinfo[i].cpu) < 0)
ULLong cannot hold -1. Is 'int' sufficient, since physical CPU numbers will never exceed 32 signed bits? (A machine with 2 billion cores seems unlikely...) -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

----- Original Message -----
From: "Eric Blake" <eblake@redhat.com> To: "Francesco Romani" <fromani@redhat.com>, libvir-list@redhat.com Sent: Wednesday, December 10, 2014 6:16:07 PM Subject: Re: [libvirt] [PATCH] qemu: bulk stats: add pcpu placement information
+++ b/src/libvirt-domain.c @@ -10888,6 +10888,8 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * from virVcpuState enum. * "vcpu.<num>.time" - virtual cpu time spent by virtual CPU <num> * as unsigned long long. + * "vcpu.<num>.physical" - real CPU number on which virtual CPU <num> is + * running, or -1 if offline.
As which type?
+ if (virTypedParamsAddULLong(&record->params, + &record->nparams, + maxparams, + param_name, + cpuinfo[i].cpu) < 0)
ULLong cannot hold -1. Is 'int' sufficient, since physical CPU numbers will never exceed 32 signed bits? (A machine with 2 billion cores seems unlikely...)
Oops, hit 'send' too early, apologies for the noise. Fixed patch coming in a snap. Thanks and bests, -- Francesco Romani RedHat Engineering Virtualization R & D Phone: 8261328 IRC: fromani
participants (2)
-
Eric Blake
-
Francesco Romani