提交 d277d614 编写于 作者: M Martin Kletzander

util: Add virNumaGetHostNodeset

That function tries its best to create a bitmap of host NUMA nodes.
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 1a80b97d
......@@ -1750,6 +1750,7 @@ virNodeSuspendGetTargetMask;
# util/virnuma.h
virNumaGetAutoPlacementAdvice;
virNumaGetDistances;
virNumaGetHostNodeset;
virNumaGetMaxNode;
virNumaGetNodeMemory;
virNumaGetPageInfo;
......
......@@ -983,3 +983,31 @@ virNumaNodesetIsAvailable(virBitmapPtr nodeset)
}
return true;
}
virBitmapPtr
virNumaGetHostNodeset(void)
{
int maxnode = virNumaGetMaxNode();
size_t i = 0;
virBitmapPtr nodeset = NULL;
if (maxnode < 0)
return NULL;
if (!(nodeset = virBitmapNew(maxnode + 1)))
return NULL;
for (i = 0; i <= maxnode; i++) {
if (!virNumaNodeIsAvailable(i))
continue;
if (virBitmapSetBit(nodeset, i) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Problem setting bit in bitmap"));
virBitmapFree(nodeset);
return NULL;
}
}
return nodeset;
}
......@@ -33,6 +33,7 @@ char *virNumaGetAutoPlacementAdvice(unsigned short vcups,
int virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode,
virBitmapPtr nodeset);
virBitmapPtr virNumaGetHostNodeset(void);
bool virNumaNodesetIsAvailable(virBitmapPtr nodeset);
bool virNumaIsAvailable(void);
int virNumaGetMaxNode(void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册