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.
---
src/conf/domain_conf.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c7843dc..5bb0616 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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;
}
--
2.6.2