qemu: Use virCPUCompare in qemuConnectCompareHypervisorCPU directly

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>
This commit is contained in:
Jiri Denemark 2024-10-15 12:31:09 +02:00
parent 1c45473b93
commit 52d2a8eb6c

View File

@ -11637,17 +11637,15 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn,
return VIR_CPU_COMPARE_ERROR; return VIR_CPU_COMPARE_ERROR;
} }
if (ARCH_IS_X86(arch)) { if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu,
return virCPUCompareXML(arch, hvCPU, xmlCPU, failIncompatible, validateXML) < 0)
validateXML); return VIR_CPU_COMPARE_ERROR;
}
if (ARCH_IS_X86(arch))
return virCPUCompare(arch, hvCPU, cpu, failIncompatible);
if (ARCH_IS_S390(arch) && if (ARCH_IS_S390(arch) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON)) { 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->model) {
if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) { if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) {
cpu->model = g_strdup("host"); cpu->model = g_strdup("host");