/* NB, this is not static as we need to call it from the testsuite */
int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
- virNodeInfoPtr nodeinfo);
+ virNodeInfoPtr nodeinfo,
+ bool need_hyperthreads);
/* Return the positive decimal contents of the given
* CPU_SYS_PATH/cpu%u/FILE, or -1 on error. If MISSING_OK and the
}
int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
- virNodeInfoPtr nodeinfo)
+ virNodeInfoPtr nodeinfo,
+ bool need_hyperthreads)
{
char line[1024];
DIR *cpudir = NULL;
return -1;
}
+ if (!need_hyperthreads)
+ return 0;
+
/* OK, we've parsed what we can out of /proc/cpuinfo. Get the socket
* and thread information from /sys
*/
_("cannot open %s"), CPUINFO_PATH);
return -1;
}
- ret = linuxNodeInfoCPUPopulate(cpuinfo, nodeinfo);
+ ret = linuxNodeInfoCPUPopulate(cpuinfo, nodeinfo, true);
VIR_FORCE_FCLOSE(cpuinfo);
if (ret < 0)
return -1;
# define MAX_FILE 4096
-extern int linuxNodeInfoCPUPopulate(FILE *cpuinfo, virNodeInfoPtr nodeinfo);
+extern int linuxNodeInfoCPUPopulate(FILE *cpuinfo, virNodeInfoPtr nodeinfo,
+ bool need_hyperthreads);
static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile) {
char actualData[MAX_FILE];
return -1;
memset(&nodeinfo, 0, sizeof(nodeinfo));
- if (linuxNodeInfoCPUPopulate(cpuinfo, &nodeinfo) < 0) {
+ if (linuxNodeInfoCPUPopulate(cpuinfo, &nodeinfo, false) < 0) {
if (virTestGetDebug()) {
virErrorPtr error = virSaveLastError();
if (error && error->code != VIR_ERR_OK)