Hello,
How do I get the "size of CPU map in underlying virtualization
system"
described in maplen comments?
The maplen must be computed from the number of
physical CPU of the
platform. This information can be get from the virNodeGetInfo() libvirt API.
In example:
virNodeInfo nodeInfo;
virConnectPtr pLibvirt;
int mapLen;
pLibvirt = virConnectOpen(NULL);
virNodeGetInfo(pLibvirt, &nodeInfo);
mapLen = (nodeInfo.cpus + 7) / 8;
If there is no physical cpu affinity (e.g. the default - vcpus can
float among any pcpu), does each cpumap in cpumaps have all bits set?
Do we indicate no affinity by having all possible pcpus marked as bound?
If the
affinity is 'any', each bit of the related CPU in the cpumap is
set. In example, if your platform has 4 processors, then the cpumap
value will be 0x0F which means: pcpu #0, pcpu #1, pcpu #2 and pcpu #3.
The non existent processors have their related bits set to 0 in cpumap.
To indicate the 'any' affinity, all bits in cpumap must be set before
calling the virDomainPinVcpu API.
Regards,
Philippe Berthault.