提交 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; ...@@ -1750,6 +1750,7 @@ virNodeSuspendGetTargetMask;
# util/virnuma.h # util/virnuma.h
virNumaGetAutoPlacementAdvice; virNumaGetAutoPlacementAdvice;
virNumaGetDistances; virNumaGetDistances;
virNumaGetHostNodeset;
virNumaGetMaxNode; virNumaGetMaxNode;
virNumaGetNodeMemory; virNumaGetNodeMemory;
virNumaGetPageInfo; virNumaGetPageInfo;
......
...@@ -983,3 +983,31 @@ virNumaNodesetIsAvailable(virBitmapPtr nodeset) ...@@ -983,3 +983,31 @@ virNumaNodesetIsAvailable(virBitmapPtr nodeset)
} }
return true; 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, ...@@ -33,6 +33,7 @@ char *virNumaGetAutoPlacementAdvice(unsigned short vcups,
int virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode, int virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode,
virBitmapPtr nodeset); virBitmapPtr nodeset);
virBitmapPtr virNumaGetHostNodeset(void);
bool virNumaNodesetIsAvailable(virBitmapPtr nodeset); bool virNumaNodesetIsAvailable(virBitmapPtr nodeset);
bool virNumaIsAvailable(void); bool virNumaIsAvailable(void);
int virNumaGetMaxNode(void); int virNumaGetMaxNode(void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册