提交 5750149f 编写于 作者: A Andrea Bolognani

cpu: Move check for NULL CPU model inside the driver

While the check is appropriate for eg. the x86 and generic drivers,
there are some valid ppc64 guest configurations where the CPU
model is supposed to be NULL.

Moving this check from the generic code to the drivers makes it
possible to accomodate both use cases.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1251927
上级 2f913162
......@@ -142,12 +142,6 @@ cpuCompare(virCPUDefPtr host,
VIR_DEBUG("host=%p, cpu=%p", host, cpu);
if (!cpu->model) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("no guest CPU model specified"));
return VIR_CPU_COMPARE_ERROR;
}
if ((driver = cpuGetSubDriver(host->arch)) == NULL)
return VIR_CPU_COMPARE_ERROR;
......@@ -376,12 +370,6 @@ cpuGuestData(virCPUDefPtr host,
VIR_DEBUG("host=%p, guest=%p, data=%p, msg=%p", host, guest, data, msg);
if (!guest->model) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("no guest CPU model specified"));
return VIR_CPU_COMPARE_ERROR;
}
if ((driver = cpuGetSubDriver(host->arch)) == NULL)
return VIR_CPU_COMPARE_ERROR;
......
......@@ -65,6 +65,12 @@ genericCompare(virCPUDefPtr host,
size_t i;
unsigned int reqfeatures;
if (!cpu->model) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("no guest CPU model specified"));
goto cleanup;
}
if ((cpu->arch != VIR_ARCH_NONE &&
host->arch != cpu->arch) ||
STRNEQ(host->model, cpu->model)) {
......
......@@ -71,7 +71,8 @@ ppc64ConvertLegacyCPUDef(const virCPUDef *legacy)
if (!(cpu = virCPUDefCopy(legacy)))
goto out;
if (!(STREQ(cpu->model, "POWER7_v2.1") ||
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"))) {
......
......@@ -1371,6 +1371,12 @@ x86Compute(virCPUDefPtr host,
virArch arch;
size_t i;
if (!cpu->model) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("no guest CPU model specified"));
return VIR_CPU_COMPARE_ERROR;
}
if (cpu->arch != VIR_ARCH_NONE) {
bool found = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册