#define CPUMAPFILE PKGDATADIR "/cpu_map.xml"
+static char *cpumap;
+
VIR_ENUM_IMPL(cpuMapElement, CPU_MAP_ELEMENT_LAST,
"vendor",
"feature",
char *xpath = NULL;
int ret = -1;
int element;
+ const char *mapfile = (cpumap ? cpumap : CPUMAPFILE);
if (arch == NULL) {
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
return -1;
}
- if ((xml = xmlParseFile(CPUMAPFILE)) == NULL) {
+ if ((xml = xmlParseFile(mapfile)) == NULL) {
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse CPU map file: %s"),
- CPUMAPFILE);
+ mapfile);
goto cleanup;
}
virReportOOMError();
goto cleanup;
}
+
+
+int
+cpuMapOverride(const char *path)
+{
+ char *map;
+
+ if (!(map = strdup(path)))
+ return -1;
+
+ VIR_FREE(cpumap);
+ cpumap = map;
+ return 0;
+}