diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index ba411a0af6..85b7c8f537 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1121,7 +1121,7 @@ bhyveNodeGetMemoryStats(virConnectPtr conn, if (virNodeGetMemoryStatsEnsureACL(conn) < 0) return -1; - return nodeGetMemoryStats(cellNum, params, nparams, flags); + return nodeGetMemoryStats(NULL, cellNum, params, nparams, flags); } static int diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index e0e72ea91a..81bb71186c 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -5486,7 +5486,7 @@ lxcNodeGetMemoryStats(virConnectPtr conn, if (virNodeGetMemoryStatsEnsureACL(conn) < 0) return -1; - return nodeGetMemoryStats(cellNum, params, nparams, flags); + return nodeGetMemoryStats(NULL, cellNum, params, nparams, flags); } diff --git a/src/nodeinfo.c b/src/nodeinfo.c index a71d05ef55..ca9cb3a66e 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -1141,7 +1141,8 @@ int nodeGetCPUStats(int cpuNum ATTRIBUTE_UNUSED, #endif } -int nodeGetMemoryStats(int cellNum ATTRIBUTE_UNUSED, +int nodeGetMemoryStats(const char *sysfs_prefix ATTRIBUTE_UNUSED, + int cellNum ATTRIBUTE_UNUSED, virNodeMemoryStatsPtr params ATTRIBUTE_UNUSED, int *nparams ATTRIBUTE_UNUSED, unsigned int flags) @@ -1151,6 +1152,7 @@ int nodeGetMemoryStats(int cellNum ATTRIBUTE_UNUSED, #ifdef __linux__ { int ret; + const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH; char *meminfo_path = NULL; FILE *meminfo; int max_node; @@ -1170,7 +1172,7 @@ int nodeGetMemoryStats(int cellNum ATTRIBUTE_UNUSED, } if (virAsprintf(&meminfo_path, "%s/node/node%d/meminfo", - SYSFS_SYSTEM_PATH, cellNum) < 0) + prefix, cellNum) < 0) return -1; } meminfo = fopen(meminfo_path, "r"); diff --git a/src/nodeinfo.h b/src/nodeinfo.h index b28aaab2ea..4f983c231c 100644 --- a/src/nodeinfo.h +++ b/src/nodeinfo.h @@ -33,7 +33,8 @@ int nodeGetCPUStats(int cpuNum, virNodeCPUStatsPtr params, int *nparams, unsigned int flags); -int nodeGetMemoryStats(int cellNum, +int nodeGetMemoryStats(const char *sysfs_prefix, + int cellNum, virNodeMemoryStatsPtr params, int *nparams, unsigned int flags); diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 280b998371..fc8db7ea1d 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -2177,7 +2177,7 @@ openvzNodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED, int *nparams, unsigned int flags) { - return nodeGetMemoryStats(cellNum, params, nparams, flags); + return nodeGetMemoryStats(NULL, cellNum, params, nparams, flags); } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index fc089af236..8233dadb4b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18434,7 +18434,7 @@ qemuNodeGetMemoryStats(virConnectPtr conn, if (virNodeGetMemoryStatsEnsureACL(conn) < 0) return -1; - return nodeGetMemoryStats(cellNum, params, nparams, flags); + return nodeGetMemoryStats(NULL, cellNum, params, nparams, flags); } diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 86066160d5..c3c5fa7d9a 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -2810,7 +2810,7 @@ umlNodeGetMemoryStats(virConnectPtr conn, if (virNodeGetMemoryStatsEnsureACL(conn) < 0) return -1; - return nodeGetMemoryStats(cellNum, params, nparams, flags); + return nodeGetMemoryStats(NULL, cellNum, params, nparams, flags); }