Test code will need to know whether the virQEMUCaps object contains any
machine types already. Add a helper and expose it via 'qemu_capspriv.h'.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 16 ++++++++++++++++
src/qemu/qemu_capspriv.h | 3 +++
2 files changed, 19 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 142698a3d5..71e3b3ec10 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2523,6 +2523,22 @@ virQEMUCapsAddMachine(virQEMUCapsPtr qemuCaps,
mach->qemuDefault = isDefault;
}
+/**
+ * virQEMUCapsHasMachines:
+ * @qemuCaps: qemu capabilities object
+ *
+ * Returns true if @qemuCaps has at least one machine type defined. This is
+ * called by the test suite to figure out whether to populate fake machine types
+ * into the list.
+ */
+bool
+virQEMUCapsHasMachines(virQEMUCapsPtr qemuCaps)
+{
+
+ return !!qemuCaps->kvm.nmachineTypes || !!qemuCaps->tcg.nmachineTypes;
+}
+
+
static int
virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps,
virDomainVirtType virtType,
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index a7492fffd2..9c2be24ada 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -108,6 +108,9 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps,
void
virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps);
+bool
+virQEMUCapsHasMachines(virQEMUCapsPtr qemuCaps);
+
void
virQEMUCapsAddMachine(virQEMUCapsPtr qemuCaps,
virDomainVirtType virtType,
--
2.24.1