From 961deedc28962b55c37430f974016aced31e1120 Mon Sep 17 00:00:00 2001
Message-Id: <961deedc28962b55c37430f974016aced31e1120@dist-git>
From: Collin Walling <walling@linux.ibm.com>
Date: Fri, 2 Oct 2020 10:13:11 +0200
Subject: [PATCH] qemu: substitute missing model name for host-passthrough
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
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 9c6996124f4ef1635fbfe47090dadaf5a12b42e9)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1850680
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Message-Id: <20201002081311.449901-2-twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@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 b5df0c63d4..f8a259e020 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13539,6 +13539,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);
--
2.28.0