From: Collin Walling Date: Wed, 23 Sep 2020 07:26:58 +0000 (+0200) Subject: qemu: substitute missing model name for host-passthrough X-Git-Tag: v6.8.0-rc1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c6996124f4ef1635fbfe47090dadaf5a12b42e9;p=thirdparty%2Flibvirt.git qemu: substitute missing model name for host-passthrough Before: $ uname -m s390x $ cat passthrough-cpu.xml $ 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 Signed-off-by: Tim Wiederhake Signed-off-by: Collin Walling Reviewed-by: Jiri Denemark --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ae715c01d7..1cecef01f7 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_INVALID_ARG, "%s", + _("cpu parameter is missing a model name")); + goto cleanup; + } + } ret = qemuConnectCPUModelComparison(qemuCaps, cfg->libDir, cfg->user, cfg->group, hvCPU, cpu, failIncompatible);