mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
util: Add virNumaGetHostNodeset
That function tries its best to create a bitmap of host NUMA nodes. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
1a80b97ddf
commit
d277d61420
@ -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)
|
|||||||
}
|
}
|
||||||
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,
|
|||||||
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user