mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
numa: avoid failure in nodememstats on non-NUMA systems
libvirt reports a fake NUMA topology in virConnectGetCapabilities even if built without numactl support. The fake NUMA topology consists of a single cell representing the host's cpu and memory resources. Currently this is the case for ARM and s390[x] RPM builds. A client iterating over NUMA cells obtained via virConnectGetCapabilities and invoking virNodeGetMemoryStats on them will see an internal failure "NUMA isn't available on this host" from virNumaGetMaxNode. An example for such a client is VDSM. Since the intention seems to be that libvirt always reports at least a single cell it is necessary to return "fake" node memory statistics matching the previously reported fake cell in case NUMA isn't supported on the system. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
This commit is contained in:
parent
61f8361545
commit
010f88d5cb
@ -267,6 +267,14 @@ virHostMemGetStats(int cellNum ATTRIBUTE_UNUSED,
|
|||||||
FILE *meminfo;
|
FILE *meminfo;
|
||||||
int max_node;
|
int max_node;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Even if built without numactl, libvirt claims
|
||||||
|
* to have a one-cells NUMA topology. In such a
|
||||||
|
* case return the statistics for the entire host.
|
||||||
|
*/
|
||||||
|
if (!virNumaIsAvailable() && cellNum == 0)
|
||||||
|
cellNum = VIR_NODE_MEMORY_STATS_ALL_CELLS;
|
||||||
|
|
||||||
if (cellNum == VIR_NODE_MEMORY_STATS_ALL_CELLS) {
|
if (cellNum == VIR_NODE_MEMORY_STATS_ALL_CELLS) {
|
||||||
if (VIR_STRDUP(meminfo_path, MEMINFO_PATH) < 0)
|
if (VIR_STRDUP(meminfo_path, MEMINFO_PATH) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user