提交 0fe41f1a 编写于 作者: P Peter Krempa

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.
上级 e498e904
...@@ -1473,6 +1473,7 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, ...@@ -1473,6 +1473,7 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
int hostcpus, int hostcpus,
virBitmapPtr autoCpuset) virBitmapPtr autoCpuset)
{ {
int maxvcpus = virDomainDefGetVcpusMax(def);
virBitmapPtr allcpumap = NULL; virBitmapPtr allcpumap = NULL;
size_t i; size_t i;
...@@ -1484,17 +1485,10 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, ...@@ -1484,17 +1485,10 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
virBitmapSetAll(allcpumap); virBitmapSetAll(allcpumap);
/* Clamp to actual number of vcpus */ for (i = 0; i < maxvcpus && i < ncpumaps; i++) {
if (ncpumaps > virDomainDefGetVcpus(def))
ncpumaps = virDomainDefGetVcpus(def);
for (i = 0; i < ncpumaps; i++) {
virDomainVcpuInfoPtr vcpu = virDomainDefGetVcpu(def, i); virDomainVcpuInfoPtr vcpu = virDomainDefGetVcpu(def, i);
virBitmapPtr bitmap = NULL; virBitmapPtr bitmap = NULL;
if (!vcpu->online)
continue;
if (vcpu->cpumask) if (vcpu->cpumask)
bitmap = vcpu->cpumask; bitmap = vcpu->cpumask;
else if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO && else if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO &&
...@@ -1509,7 +1503,7 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, ...@@ -1509,7 +1503,7 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
} }
virBitmapFree(allcpumap); virBitmapFree(allcpumap);
return ncpumaps; return i;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册