nodeinfo: Add sysfs_prefix to nodeGetCPUMap

Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
This commit is contained in:
John Ferlan 2015-07-06 17:49:04 -04:00
parent f220a3e5a8
commit f1c6179f0d
8 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -5553,7 +5553,7 @@ lxcNodeGetCPUMap(virConnectPtr conn,
if (virNodeGetCPUMapEnsureACL(conn) < 0)
return -1;
return nodeGetCPUMap(cpumap, online, flags);
return nodeGetCPUMap(NULL, cpumap, online, flags);
}

View File

@ -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)

View File

@ -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);

View File

@ -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);
}

View File

@ -18501,7 +18501,7 @@ qemuNodeGetCPUMap(virConnectPtr conn,
if (virNodeGetCPUMapEnsureACL(conn) < 0)
return -1;
return nodeGetCPUMap(cpumap, online, flags);
return nodeGetCPUMap(NULL, cpumap, online, flags);
}

View File

@ -2877,7 +2877,7 @@ umlNodeGetCPUMap(virConnectPtr conn,
if (virNodeGetCPUMapEnsureACL(conn) < 0)
return -1;
return nodeGetCPUMap(cpumap, online, flags);
return nodeGetCPUMap(NULL, cpumap, online, flags);
}

View File

@ -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