[libvirt] [PATCH 1/3 V7] add nodeGetCPUmap() for getting available CPU IDs in a cpumap.

Richard W.M. Jones rjones at redhat.com
Wed Mar 7 10:36:10 UTC 2012


On Tue, Mar 06, 2012 at 10:02:15PM -0700, Eric Blake wrote:
> On 03/06/2012 05:10 AM, Richard W.M. Jones wrote:
> > 
> > This all appears to work.  I built my own libvirt with the three
> > remaining patches and was able to read pCPU information for a running
> > domain.
> 
> The libvirt side is now pushed.
> 
> Rich:
> The documentation in libvirt.c correctly says that calling
> virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0) must tell you part of the
> information needed to compute the size of an array to allocate; but in
> v7, the return was off by one too small.  But it was generally masked by
> the v7 virsh code overallocating to a fixed 128 slots rather than paying
> attention to the return value.  I fixed both those problems before
> pushing the libvirt patches, but since you tested with v7 instead of my
> fixed version, you may need to double check that virt-top isn't making
> the same mistakes, as it might be a boundary case that only strikes on
> machines with 128 physical CPUs.

TBH I found the documentation for virDomainGetCPUStats to be very
confusing indeed.  I couldn't really tell if virt-top is calling the
API correctly or not, so I simply used Fujitsu's code directly.

Do you have any comments on whether this is correct or not?

http://git.annexia.org/?p=ocaml-libvirt.git;a=blob;f=libvirt/libvirt_c_oneoffs.c;h=f827707a77e6478129370fce67e46ae745b9be9a;hb=HEAD#l534

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the libvir-list mailing list