[PATCH for 1.2.7 6/8] qemu_capabilities: Introduce virQEMUCapsIsMachineSupported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This internal API is meant to answer the question 'Is this machine
type supported by given qemu?'.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 14 ++++++++++++++
 src/qemu/qemu_capabilities.h |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b357255..46e469c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3542,3 +3542,17 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
             (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
              chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO));
 }
+
+
+bool
+virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
+                              const char *canonical_machine)
+{
+    size_t i;
+
+    for (i = 0; i < qemuCaps->nmachineTypes; i++) {
+        if (STREQ(canonical_machine, qemuCaps->machineTypes[i]))
+            return true;
+    }
+    return false;
+}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 1eb92b5..4857dfd 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -302,6 +302,9 @@ bool virQEMUCapsSupportsChardev(virDomainDefPtr def,
                                 virQEMUCapsPtr qemuCaps,
                                 virDomainChrDefPtr chr);
 
+bool virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
+                                   const char *canonical_machine);
+
 int virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
                                    const char *binary,
                                    virQEMUCapsPtr qemubinCaps,
-- 
1.8.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]