That function tries its best to create a bitmap of host NUMA nodes. Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> --- src/libvirt_private.syms | 1 + src/util/virnuma.c | 28 ++++++++++++++++++++++++++++ src/util/virnuma.h | 1 + 3 files changed, 30 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 60979f8..b21f5fb 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1748,6 +1748,7 @@ virNodeSuspendGetTargetMask; # util/virnuma.h virNumaGetAutoPlacementAdvice; virNumaGetDistances; +virNumaGetHostNodeset; virNumaGetMaxNode; virNumaGetNodeMemory; virNumaGetPageInfo; diff --git a/src/util/virnuma.c b/src/util/virnuma.c index b8d76f4..86564d4 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -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; +} diff --git a/src/util/virnuma.h b/src/util/virnuma.h index 09034a2..1f3c0ad 100644 --- a/src/util/virnuma.h +++ b/src/util/virnuma.h @@ -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); -- 2.2.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list