qemu: Report pinning for all vCPUs in qemuDomainGetVcpuPinInfo

The API documentation states that the function is returning pinning for
all vCPUs, so we can actually do so if the user passes a large enough
array.
This commit is contained in:
Peter Krempa 2016-02-12 14:57:41 +01:00
parent e498e90469
commit 0fe41f1a8a

View File

@ -1473,6 +1473,7 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
int hostcpus,
virBitmapPtr autoCpuset)
{
int maxvcpus = virDomainDefGetVcpusMax(def);
virBitmapPtr allcpumap = NULL;
size_t i;
@ -1484,17 +1485,10 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
virBitmapSetAll(allcpumap);
/* Clamp to actual number of vcpus */
if (ncpumaps > virDomainDefGetVcpus(def))
ncpumaps = virDomainDefGetVcpus(def);
for (i = 0; i < ncpumaps; i++) {
for (i = 0; i < maxvcpus && i < ncpumaps; i++) {
virDomainVcpuInfoPtr vcpu = virDomainDefGetVcpu(def, i);
virBitmapPtr bitmap = NULL;
if (!vcpu->online)
continue;
if (vcpu->cpumask)
bitmap = vcpu->cpumask;
else if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO &&
@ -1509,7 +1503,7 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
}
virBitmapFree(allcpumap);
return ncpumaps;
return i;
}