virsh cpu-baseline determines baseline from QEMU for some architectures
and libvirt for others.
Skip the QEMU attempt to save time on architectures QEMU baseline does
not support.
---
src/qemu/qemu_driver.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 83fc191085..6096d46ab5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13166,6 +13166,15 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
virCPUDefPtr baseline = NULL;
virCPUDefPtr cpu = NULL;
char *cpustr = NULL;
+ virBuffer baseline_xml = VIR_BUFFER_INITIALIZER;
+ virArch arch = virArchFromHost();
+
+ VIR_DEBUG("ncpus=%i, flags=0x%x", ncpus, flags);
+
+ virQEMUDriverPtr driver = conn->privateData;
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+
+ bool migratable = !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE);
virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
@@ -13173,6 +13182,23 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
if (virConnectBaselineCPUEnsureACL(conn) < 0)
goto cleanup;
+
+ if (!ARCH_IS_S390(arch))
+ goto libvirt_method; /* Avoid starting QEMU */
+
+ /* Try QEMU method
+ */
+ if (virQEMUCapsQMPBaselineCPUModel(NULL,
+ cfg->libDir, cfg->user, cfg->group,
+ xmlCPUs, ncpus, migratable, &baseline_xml)
< 0) {
+ /* Content Error */
+ goto cleanup;
+ }
+
+ if ((cpustr = virBufferContentAndReset(&baseline_xml)))
+ goto done;
+
+ libvirt_method:
if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST)))
goto cleanup;
@@ -13199,6 +13225,9 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
virCPUDefFree(baseline);
virCPUDefFree(cpu);
+ done:
+ VIR_DEBUG("qemu cpustr = %s", NULLSTR(cpustr));
+
return cpustr;
}
--
2.14.1