diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index dc76cf702d..68dff6c8d9 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1299,7 +1299,7 @@ bhyveNodeGetCPUMap(virConnectPtr conn, if (virNodeGetCPUMapEnsureACL(conn) < 0) return -1; - return nodeGetCPUMap(cpumap, online, flags); + return nodeGetCPUMap(NULL, cpumap, online, flags); } static int diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index cc1277bddc..31201a0e5a 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -5553,7 +5553,7 @@ lxcNodeGetCPUMap(virConnectPtr conn, if (virNodeGetCPUMapEnsureACL(conn) < 0) return -1; - return nodeGetCPUMap(cpumap, online, flags); + return nodeGetCPUMap(NULL, cpumap, online, flags); } diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 75e0a02a83..bf4f751e55 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -1624,10 +1624,12 @@ nodeGetMemoryParameters(virTypedParameterPtr params ATTRIBUTE_UNUSED, } int -nodeGetCPUMap(unsigned char **cpumap, +nodeGetCPUMap(const char *sysfs_prefix, + unsigned char **cpumap, unsigned int *online, unsigned int flags) { + const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH; virBitmapPtr cpus = NULL; int maxpresent; int ret = -1; @@ -1636,9 +1638,9 @@ nodeGetCPUMap(unsigned char **cpumap, virCheckFlags(0, -1); if (!cpumap && !online) - return nodeGetCPUCount(NULL); + return nodeGetCPUCount(prefix); - if (!(cpus = nodeGetCPUBitmap(NULL, &maxpresent))) + if (!(cpus = nodeGetCPUBitmap(prefix, &maxpresent))) goto cleanup; if (cpumap && virBitmapToData(cpus, cpumap, &dummy) < 0) diff --git a/src/nodeinfo.h b/src/nodeinfo.h index 439ef35ed6..9e6904f2d4 100644 --- a/src/nodeinfo.h +++ b/src/nodeinfo.h @@ -55,7 +55,8 @@ int nodeSetMemoryParameters(virTypedParameterPtr params, int nparams, unsigned int flags); -int nodeGetCPUMap(unsigned char **cpumap, +int nodeGetCPUMap(const char *sysfs_prefix, + unsigned char **cpumap, unsigned int *online, unsigned int flags); diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index d1a327c00a..fc6f101741 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -2207,7 +2207,7 @@ openvzNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned int *online, unsigned int flags) { - return nodeGetCPUMap(cpumap, online, flags); + return nodeGetCPUMap(NULL, cpumap, online, flags); } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0ca81e1c68..9b085559fe 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18501,7 +18501,7 @@ qemuNodeGetCPUMap(virConnectPtr conn, if (virNodeGetCPUMapEnsureACL(conn) < 0) return -1; - return nodeGetCPUMap(cpumap, online, flags); + return nodeGetCPUMap(NULL, cpumap, online, flags); } diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 7a95458119..99162f72ad 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -2877,7 +2877,7 @@ umlNodeGetCPUMap(virConnectPtr conn, if (virNodeGetCPUMapEnsureACL(conn) < 0) return -1; - return nodeGetCPUMap(cpumap, online, flags); + return nodeGetCPUMap(NULL, cpumap, online, flags); } diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 9f0c52f29f..bfa901dd45 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -852,7 +852,7 @@ vzNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned int *online, unsigned int flags) { - return nodeGetCPUMap(cpumap, online, flags); + return nodeGetCPUMap(NULL, cpumap, online, flags); } static int