]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu_capabilities: Introduce virQEMUCapsGetDefaultMachine
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 30 Jun 2014 14:39:18 +0000 (16:39 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 3 Jul 2014 10:22:38 +0000 (12:22 +0200)
Sometimes it may be useful to get a default machine for given qemu
binary. Fortunately, the default machine is stored always on the first
position in the supported machines array.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h

index 7a61b3196eab18adee5d4aa046d727af08415c62..ac6b5c82c2f9d6f9ad55806e0f4cbfd96b309eb7 100644 (file)
@@ -3556,3 +3556,12 @@ virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
     }
     return false;
 }
+
+
+const char *
+virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps)
+{
+    if (!qemuCaps->nmachineTypes)
+        return NULL;
+    return qemuCaps->machineTypes[0];
+}
index 4857dfde421bb54431a25369de8e74f128cde0a0..d0a1092ada1609c6ed9ac9a44bcc4c0031da146d 100644 (file)
@@ -305,6 +305,8 @@ bool virQEMUCapsSupportsChardev(virDomainDefPtr def,
 bool virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
                                    const char *canonical_machine);
 
+const char * virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps);
+
 int virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
                                    const char *binary,
                                    virQEMUCapsPtr qemubinCaps,