virQEMUCapsInitQMPMonitor is massive now since it collects calls to the
various probing functions and also version based capabilities. Split
out the version based caps into a separate function.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 124 +++++++++++++++++++----------------
1 file changed, 69 insertions(+), 55 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 56228e7a36..04199b1a76 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4145,6 +4145,73 @@ virQEMUCapsInitQMPBasicArch(virQEMUCapsPtr qemuCaps)
}
+/**
+ * virQEMUCapsInitQMPVersionCaps:
+ * @qemuCaps: QEMU capabilities
+ *
+ * Add all QEMU capabilities based on version of QEMU.
+ */
+static void
+virQEMUCapsInitQMPVersionCaps(virQEMUCapsPtr qemuCaps)
+{
+ if (qemuCaps->version >= 1006000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+
+ /* vmport option is supported v2.2.0 onwards */
+ if (qemuCaps->version >= 2002000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT);
+
+ /* -cpu ...,aarch64=off supported in v2.3.0 and onwards. But it
+ isn't detectable via qmp at this point */
+ if (qemuCaps->arch == VIR_ARCH_AARCH64 &&
+ qemuCaps->version >= 2003000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_AARCH64_OFF);
+
+ /* vhost-user supports multi-queue from v2.4.0 onwards,
+ * but there is no way to query for that capability */
+ if (qemuCaps->version >= 2004000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
+
+ /* smm option is supported from v2.4.0 */
+ if (qemuCaps->version >= 2004000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT);
+
+ /* sdl -gl option is supported from v2.4.0 (qemu commit id 0b71a5d5) */
+ if (qemuCaps->version >= 2004000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL_GL);
+
+ /* Since 2.4.50 ARM virt machine supports gic-version option */
+ if (qemuCaps->version >= 2004050)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+
+ /* no way to query if -machine kernel_irqchip supports split */
+ if (qemuCaps->version >= 2006000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT);
+
+ /* HPT resizing is supported since QEMU 2.10 on ppc64; unfortunately
+ * there's no sane way to probe for it */
+ if (qemuCaps->version >= 2010000 &&
+ ARCH_IS_PPC64(qemuCaps->arch)) {
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
+ }
+
+ /* '-display egl-headless' cmdline option is supported since QEMU 2.10, but
+ * there's no way to probe it */
+ if (qemuCaps->version >= 2010000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_EGL_HEADLESS);
+
+ /* no way to query for -numa dist */
+ if (qemuCaps->version >= 2010000)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NUMA_DIST);
+
+ /* no way to query max-cpu-compat */
+ if (qemuCaps->version >= 2010000 &&
+ ARCH_IS_PPC64(qemuCaps->arch)) {
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT);
+ }
+}
+
+
static int
virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
@@ -4223,61 +4290,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
virQEMUCapsInitQMPBasicArch(qemuCaps);
- if (qemuCaps->version >= 1006000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
-
- /* vmport option is supported v2.2.0 onwards */
- if (qemuCaps->version >= 2002000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT);
-
- /* -cpu ...,aarch64=off supported in v2.3.0 and onwards. But it
- isn't detectable via qmp at this point */
- if (qemuCaps->arch == VIR_ARCH_AARCH64 &&
- qemuCaps->version >= 2003000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_AARCH64_OFF);
-
- /* vhost-user supports multi-queue from v2.4.0 onwards,
- * but there is no way to query for that capability */
- if (qemuCaps->version >= 2004000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
-
- /* smm option is supported from v2.4.0 */
- if (qemuCaps->version >= 2004000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT);
-
- /* sdl -gl option is supported from v2.4.0 (qemu commit id 0b71a5d5) */
- if (qemuCaps->version >= 2004000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL_GL);
-
- /* Since 2.4.50 ARM virt machine supports gic-version option */
- if (qemuCaps->version >= 2004050)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACH_VIRT_GIC_VERSION);
-
- /* no way to query if -machine kernel_irqchip supports split */
- if (qemuCaps->version >= 2006000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT);
-
- /* HPT resizing is supported since QEMU 2.10 on ppc64; unfortunately
- * there's no sane way to probe for it */
- if (qemuCaps->version >= 2010000 &&
- ARCH_IS_PPC64(qemuCaps->arch)) {
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
- }
-
- /* '-display egl-headless' cmdline option is supported since QEMU 2.10, but
- * there's no way to probe it */
- if (qemuCaps->version >= 2010000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_EGL_HEADLESS);
-
- /* no way to query for -numa dist */
- if (qemuCaps->version >= 2010000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_NUMA_DIST);
-
- /* no way to query max-cpu-compat */
- if (qemuCaps->version >= 2010000 &&
- ARCH_IS_PPC64(qemuCaps->arch)) {
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT);
- }
+ /* initiate all capapbilities based on qemu version */
+ virQEMUCapsInitQMPVersionCaps(qemuCaps);
if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0)
goto cleanup;
--
2.20.1