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