diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5cd88956a625eeb329583c503603efd1c7c73dc3..363d847c7d8cadf3989a90c21bead54115923fd7 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1750,6 +1750,7 @@ virNodeSuspendGetTargetMask; # util/virnuma.h virNumaGetAutoPlacementAdvice; virNumaGetDistances; +virNumaGetHostNodeset; virNumaGetMaxNode; virNumaGetNodeMemory; virNumaGetPageInfo; diff --git a/src/util/virnuma.c b/src/util/virnuma.c index b8d76f4074b94cb8be857e3b26e3b4c846d75634..86564d4d41187a04b1cf2f09e844fb9bbe04c812 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 09034a274b9bd6e71309d74814139042124e7962..1f3c0ad8a75de51e85a1fecea9c5a0b2ab2fd4fa 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);