Qemu now allows case-insensitive specification of CPU models. This fixes the
resulting problems on POWER arch machines. I believe a similar change is needed
in src/cpu/cpu_x86.c but I don't have a way to test this.
Signed-off-by: Scott Garfinkle <scottgar(a)linux.vnet.ibm.com>
---
src/conf/domain_capabilities.c | 2 +-
src/cpu/cpu_ppc64.c | 16 ++++++++--------
src/internal.h | 1 +
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index e7323a8..f7d9be5 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -271,7 +271,7 @@ virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels,
return NULL;
for (i = 0; i < cpuModels->nmodels; i++) {
- if (STREQ(cpuModels->models[i].name, name))
+ if (STRCASEEQ(cpuModels->models[i].name, name))
return cpuModels->models + i;
}
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 76582d4..9f7e2bb 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -67,10 +67,10 @@ static int
virCPUppc64ConvertLegacy(virCPUDefPtr cpu)
{
if (cpu->model &&
- (STREQ(cpu->model, "POWER7_v2.1") ||
- STREQ(cpu->model, "POWER7_v2.3") ||
- STREQ(cpu->model, "POWER7+_v2.1") ||
- STREQ(cpu->model, "POWER8_v1.0"))) {
+ (STRCASEEQ(cpu->model, "POWER7_v2.1") ||
+ STRCASEEQ(cpu->model, "POWER7_v2.3") ||
+ STRCASEEQ(cpu->model, "POWER7+_v2.1") ||
+ STRCASEEQ(cpu->model, "POWER8_v1.0"))) {
cpu->model[strlen("POWERx")] = 0;
}
@@ -93,7 +93,7 @@ ppc64CheckCompatibilityMode(const char *host_model,
return VIR_CPU_COMPARE_IDENTICAL;
/* Valid host CPUs: POWER6, POWER7, POWER8, POWER9 */
- if (!STRPREFIX(host_model, "POWER") ||
+ if (!STRCASEPREFIX(host_model, "POWER") ||
!(tmp = (char *) host_model + strlen("POWER")) ||
virStrToLong_i(tmp, NULL, 10, &host) < 0 ||
host < 6 || host > 9) {
@@ -104,7 +104,7 @@ ppc64CheckCompatibilityMode(const char *host_model,
}
/* Valid compatibility modes: power6, power7, power8, power9 */
- if (!STRPREFIX(compat_mode, "power") ||
+ if (!STRCASEPREFIX(compat_mode, "power") ||
!(tmp = (char *) compat_mode + strlen("power")) ||
virStrToLong_i(tmp, NULL, 10, &compat) < 0 ||
compat < 6 || compat > 9) {
@@ -168,7 +168,7 @@ ppc64VendorFind(const struct ppc64_map *map,
size_t i;
for (i = 0; i < map->nvendors; i++) {
- if (STREQ(map->vendors[i]->name, name))
+ if (STRCASEEQ(map->vendors[i]->name, name))
return map->vendors[i];
}
@@ -216,7 +216,7 @@ ppc64ModelFind(const struct ppc64_map *map,
size_t i;
for (i = 0; i < map->nmodels; i++) {
- if (STREQ(map->models[i]->name, name))
+ if (STRCASEEQ(map->models[i]->name, name))
return map->models[i];
}
diff --git a/src/internal.h b/src/internal.h
index 5895030..1760e3b 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -75,6 +75,7 @@
# define STRNEQLEN(a, b, n) (strncmp(a, b, n) != 0)
# define STRCASENEQLEN(a, b, n) (c_strncasecmp(a, b, n) != 0)
# define STRPREFIX(a, b) (strncmp(a, b, strlen(b)) == 0)
+# define STRCASEPREFIX(a, b) (c_strncasecmp(a, b, strlen(b)) == 0)
# define STRSKIP(a, b) (STRPREFIX(a, b) ? (a) + strlen(b) : NULL)
# define STREQ_NULLABLE(a, b) \
--
1.8.3.1