From 69f92a87c262ffdfcd1e9485c8eabef67d74aade Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 30 Jun 2014 16:31:51 +0200 Subject: [PATCH] qemu_capabilities: Introduce virQEMUCapsIsMachineSupported This internal API is meant to answer the question 'Is this machine type supported by given qemu?'. Signed-off-by: Michal Privoznik --- 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 2f8378a42f..7a61b3196e 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 1eb92b5231..4857dfde42 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,