qemu_capabilities: Introduce virQEMUCapsGetDefaultMachine

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>
This commit is contained in:
Michal Privoznik 2014-06-30 16:39:18 +02:00
parent 69f92a87c2
commit cb01d2b5b1
2 changed files with 11 additions and 0 deletions

View File

@ -3556,3 +3556,12 @@ virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
}
return false;
}
const char *
virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps)
{
if (!qemuCaps->nmachineTypes)
return NULL;
return qemuCaps->machineTypes[0];
}

View 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,