[libvirt PATCH 0/1] qemu: substitute missing model name for host-passthrough

See also https://www.redhat.com/archives/libvir-list/2020-June/msg01232.html Before: $ uname -m s390x $ cat passthrough-cpu.xml <cpu check="none" mode="host-passthrough" /> $ virsh hypervisor-cpu-compare passthrough-cpu.xml error: Failed to compare hypervisor CPU with passthrough-cpu.xml error: internal error: unable to execute QEMU command 'query-cpu-model-comp arison': Invalid parameter type for 'modelb.name', expected: string After: $ virsh hypervisor-cpu-compare passthrough-cpu.xml CPU described in passthrough-cpu.xml is identical to the CPU provided by hy pervisor on the host Tim Wiederhake (1): qemu: substitute missing model name for host-passthrough src/qemu/qemu_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.26.2

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- src/qemu/qemu_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ae715c01d7..7f5cfc1a7f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12336,6 +12336,15 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn, if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu) < 0) goto cleanup; + if (!cpu->model) { + if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) { + cpu->model = g_strdup("host"); + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cpu parameter is missing a model name")); + goto cleanup; + } + } ret = qemuConnectCPUModelComparison(qemuCaps, cfg->libDir, cfg->user, cfg->group, hvCPU, cpu, failIncompatible); -- 2.26.2

On Tue, Sep 22, 2020 at 15:29:28 +0200, Tim Wiederhake wrote: The stuff (before/after) you put into the cover letter should actually be here. Or a better explanation if you don't like that. But the cover letter blurb will get lost in time and this commit will have no explanation/justification.
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- src/qemu/qemu_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ae715c01d7..7f5cfc1a7f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12336,6 +12336,15 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn, if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu) < 0) goto cleanup;
+ if (!cpu->model) { + if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) { + cpu->model = g_strdup("host"); + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
VIR_ERR_INTERNAL_ERROR doesn't seem to be appropriate since it's in user provided input.
+ _("cpu parameter is missing a model name")); + goto cleanup; + } + } ret = qemuConnectCPUModelComparison(qemuCaps, cfg->libDir, cfg->user, cfg->group, hvCPU, cpu, failIncompatible); -- 2.26.2
participants (2)
-
Peter Krempa
-
Tim Wiederhake