render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
2ba5aa
From 961deedc28962b55c37430f974016aced31e1120 Mon Sep 17 00:00:00 2001
2ba5aa
Message-Id: <961deedc28962b55c37430f974016aced31e1120@dist-git>
2ba5aa
From: Collin Walling <walling@linux.ibm.com>
2ba5aa
Date: Fri, 2 Oct 2020 10:13:11 +0200
2ba5aa
Subject: [PATCH] qemu: substitute missing model name for host-passthrough
2ba5aa
2ba5aa
Before:
2ba5aa
  $ uname -m
2ba5aa
  s390x
2ba5aa
  $ cat passthrough-cpu.xml
2ba5aa
  <cpu check="none" mode="host-passthrough" />
2ba5aa
  $ virsh hypervisor-cpu-compare passthrough-cpu.xml
2ba5aa
  error: Failed to compare hypervisor CPU with passthrough-cpu.xml
2ba5aa
  error: internal error: unable to execute QEMU command 'query-cpu-model-comp
2ba5aa
  arison': Invalid parameter type for 'modelb.name', expected: string
2ba5aa
2ba5aa
After:
2ba5aa
  $ virsh hypervisor-cpu-compare passthrough-cpu.xml
2ba5aa
  CPU described in passthrough-cpu.xml is identical to the CPU provided by hy
2ba5aa
  pervisor on the host
2ba5aa
2ba5aa
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2ba5aa
Signed-off-by: Collin Walling <walling@linux.ibm.com>
2ba5aa
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2ba5aa
(cherry picked from commit 9c6996124f4ef1635fbfe47090dadaf5a12b42e9)
2ba5aa
2ba5aa
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1850680
2ba5aa
2ba5aa
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2ba5aa
Message-Id: <20201002081311.449901-2-twiederh@redhat.com>
2ba5aa
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2ba5aa
---
2ba5aa
 src/qemu/qemu_driver.c | 9 +++++++++
2ba5aa
 1 file changed, 9 insertions(+)
2ba5aa
2ba5aa
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
2ba5aa
index b5df0c63d4..f8a259e020 100644
2ba5aa
--- a/src/qemu/qemu_driver.c
2ba5aa
+++ b/src/qemu/qemu_driver.c
2ba5aa
@@ -13539,6 +13539,15 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn,
2ba5aa
         if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu) < 0)
2ba5aa
             goto cleanup;
2ba5aa
 
2ba5aa
+        if (!cpu->model) {
2ba5aa
+            if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) {
2ba5aa
+                cpu->model = g_strdup("host");
2ba5aa
+            } else {
2ba5aa
+                virReportError(VIR_ERR_INVALID_ARG, "%s",
2ba5aa
+                               _("cpu parameter is missing a model name"));
2ba5aa
+                goto cleanup;
2ba5aa
+            }
2ba5aa
+        }
2ba5aa
         ret = qemuConnectCPUModelComparison(qemuCaps, cfg->libDir,
2ba5aa
                                             cfg->user, cfg->group,
2ba5aa
                                             hvCPU, cpu, failIncompatible);
2ba5aa
-- 
2ba5aa
2.28.0
2ba5aa