[libvirt PATCH v3 3/3] qemuProcessUpdateGuestCPU: Check host cpu for forbidden features

Tim Wiederhake twiederh at redhat.com
Tue Mar 23 10:01:55 UTC 2021


See https://bugzilla.redhat.com/show_bug.cgi?id=1840770

Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/qemu/qemu_process.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index fedd1f56b1..b74afedd07 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6125,6 +6125,16 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def,
     if (virCPUConvertLegacy(hostarch, def->cpu) < 0)
         return -1;
 
+    if (def->cpu->check != VIR_CPU_CHECK_NONE) {
+        virCPUDefPtr host;
+
+        host = virQEMUCapsGetHostModel(qemuCaps, def->virtType,
+                                       VIR_QEMU_CAPS_HOST_CPU_FULL);
+
+        if (host && virCPUCheckForbiddenFeatures(def->cpu, host) < 0)
+            return -1;
+    }
+
     /* nothing to update for host-passthrough / maximum */
     if (def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH &&
         def->cpu->mode != VIR_CPU_MODE_MAXIMUM) {
-- 
2.26.2




More information about the libvir-list mailing list