[Libvir] Virtual CPUs functions

Philippe Berthault Philippe.Berthault at Bull.net
Tue Aug 1 10:45:18 UTC 2006


I'm working on the vpcu patch of Michel Ponceau because he is in 
vacation for a long time.

Michel has proposed to add 3 APIs to libvirt:
  - virDomainSetVcpus
  - virDomainPinVcpu
  - virDomainGetVcpus

I've seen in libvirt mail archives that there was a problem with the 
virDomainGetVcpus API because the virCpuInfo structure contains a CPU 
map for only 256 physical CPUs.

Your proposition to remove cpumap field from virCpuInfo structure and 
add it as parameter to the virDomainGetVcpus API isn't valid for the 
following reason:

The virDomainGetVcpus API fills an array of virCpuInfo structures (one 
virCpuInfo for one VCPU) but cpumap is for one VCPU, not for all VCPUs 
at whole. Your proposition can work only if cpumap is a array of array 
of characters and if maplen is also an array of integers. This is very 
complicated solution and not elegant.

I've also seen that you make a mistake in your proposition because you 
compute the cpuMapLen from the number of virtual CPUs but the cpumap is 
related to physical CPUs, not virtual CPUs.

So, in conclusion, I propose, as you, to remove cpumap field of the 
virCpuInfo structure but to add an API to retrieve the CPU map of one 
VCPU. Such API would be:

int virDomainGetCpus(virDomainPtr domain, unsigned int vcpu, unsigned 
char *cpumap, int maplen);

The name is ...GetCpus (not 'Vcpus') because this API get the physical 
CPU map, not the virtual CPU map.

Philippe Berthault.

More information about the libvir-list mailing list