]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Use virCPUCompare in qemuConnectCompareHypervisorCPU directly
authorJiri Denemark <jdenemar@redhat.com>
Tue, 15 Oct 2024 10:31:09 +0000 (12:31 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 23 Oct 2024 14:00:44 +0000 (16:00 +0200)
The function already parses CPU XML on s390. By parsing it consistently
on all architecture we can switch to virCPUCompare and easily replace it
with a QEMU specific helper in the following patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index 62a44bf6e7e7ac0ce753a48c762ed133cfa41741..36ec0c05905f8db2dd046ceae11a68d6e367cc4b 100644 (file)
@@ -11637,17 +11637,15 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn,
         return VIR_CPU_COMPARE_ERROR;
     }
 
-    if (ARCH_IS_X86(arch)) {
-        return virCPUCompareXML(arch, hvCPU, xmlCPU, failIncompatible,
-                                validateXML);
-    }
+    if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu,
+                                validateXML) < 0)
+        return VIR_CPU_COMPARE_ERROR;
+
+    if (ARCH_IS_X86(arch))
+        return virCPUCompare(arch, hvCPU, cpu, failIncompatible);
 
     if (ARCH_IS_S390(arch) &&
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON)) {
-        if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu,
-                                    validateXML) < 0)
-            return VIR_CPU_COMPARE_ERROR;
-
         if (!cpu->model) {
             if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) {
                 cpu->model = g_strdup("host");