提交 d9a779a3 编写于 作者: P Peter Krempa

conf: numa: Add accessor for the NUMA node cpu mask

Add virDomainNumaGetNodeCpumask() and refactor a few places that would
get the cpu mask without the helper.
上级 be22d073
...@@ -771,7 +771,7 @@ virDomainNumaDefCPUFormat(virBufferPtr buf, ...@@ -771,7 +771,7 @@ virDomainNumaDefCPUFormat(virBufferPtr buf,
for (i = 0; i < ncells; i++) { for (i = 0; i < ncells; i++) {
memAccess = def->cells[i].memAccess; memAccess = def->cells[i].memAccess;
if (!(cpustr = virBitmapFormat(def->cells[i].cpumask))) if (!(cpustr = virBitmapFormat(virDomainNumaGetNodeCpumask(def, i))))
return -1; return -1;
virBufferAddLit(buf, "<cell"); virBufferAddLit(buf, "<cell");
...@@ -799,7 +799,7 @@ virDomainNumaGetCPUCountTotal(virCPUDefPtr numa) ...@@ -799,7 +799,7 @@ virDomainNumaGetCPUCountTotal(virCPUDefPtr numa)
unsigned int ret = 0; unsigned int ret = 0;
for (i = 0; i < numa->ncells; i++) for (i = 0; i < numa->ncells; i++)
ret += virBitmapCountBits(numa->cells[i].cpumask); ret += virBitmapCountBits(virDomainNumaGetNodeCpumask(numa, i));
return ret; return ret;
} }
...@@ -824,3 +824,11 @@ virDomainNumaGetNodeCount(virCPUDefPtr numa) ...@@ -824,3 +824,11 @@ virDomainNumaGetNodeCount(virCPUDefPtr numa)
return numa->ncells; return numa->ncells;
} }
virBitmapPtr
virDomainNumaGetNodeCpumask(virCPUDefPtr numa,
size_t node)
{
return numa->cells[node].cpumask;
}
...@@ -88,6 +88,9 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune, ...@@ -88,6 +88,9 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
size_t virDomainNumaGetNodeCount(virCPUDefPtr numa) size_t virDomainNumaGetNodeCount(virCPUDefPtr numa)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
virBitmapPtr virDomainNumaGetNodeCpumask(virCPUDefPtr numa,
size_t node)
ATTRIBUTE_NONNULL(1);
/* /*
* Formatters * Formatters
......
...@@ -630,6 +630,7 @@ virNodeDeviceObjUnlock; ...@@ -630,6 +630,7 @@ virNodeDeviceObjUnlock;
virDomainNumaEquals; virDomainNumaEquals;
virDomainNumaFree; virDomainNumaFree;
virDomainNumaGetNodeCount; virDomainNumaGetNodeCount;
virDomainNumaGetNodeCpumask;
virDomainNumaNew; virDomainNumaNew;
virDomainNumatuneFormatNodeset; virDomainNumatuneFormatNodeset;
virDomainNumatuneFormatXML; virDomainNumatuneFormatXML;
......
...@@ -7199,7 +7199,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, ...@@ -7199,7 +7199,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
for (i = 0; i < ncells; i++) { for (i = 0; i < ncells; i++) {
VIR_FREE(cpumask); VIR_FREE(cpumask);
if (!(cpumask = virBitmapFormat(def->cpu->cells[i].cpumask))) if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->cpu, i))))
goto cleanup; goto cleanup;
if (strchr(cpumask, ',') && if (strchr(cpumask, ',') &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册