Signed-off-by: Tobin Feldman-Fitzthum <tobin(a)linux.vnet.ibm.com>
---
src/qemu/qemu_capabilities.c | 25 ++++++++++++++++---------
src/qemu/qemu_capabilities.h | 2 ++
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c56b2d8f0e..e7179ea048 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4984,6 +4984,20 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCapsPtr qemuCaps,
#define QEMU_MIN_MINOR 5
#define QEMU_MIN_MICRO 0
+virDomainVirtType
+virQEMUCapsGetVirtType(virQEMUCapsPtr qemuCaps)
+{
+ virDomainVirtType type;
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
+ type = VIR_DOMAIN_VIRT_KVM;
+ else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_TCG_DISABLED))
+ type = VIR_DOMAIN_VIRT_QEMU;
+ else
+ type = VIR_DOMAIN_VIRT_NONE;
+
+ return type;
+}
+
int
virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
@@ -5028,11 +5042,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
if (virQEMUCapsProbeQMPKVMState(qemuCaps, mon) < 0)
return -1;
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
- type = VIR_DOMAIN_VIRT_KVM;
- else
- type = VIR_DOMAIN_VIRT_QEMU;
-
+ type = virQEMUCapsGetVirtType(qemuCaps);
accel = virQEMUCapsGetAccel(qemuCaps, type);
if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0)
@@ -5525,10 +5535,7 @@ virQEMUCapsCacheLookupDefault(virFileCachePtr cache,
goto cleanup;
}
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
- capsType = VIR_DOMAIN_VIRT_KVM;
- else
- capsType = VIR_DOMAIN_VIRT_QEMU;
+ capsType = virQEMUCapsGetVirtType(qemuCaps);
if (virttype == VIR_DOMAIN_VIRT_NONE)
virttype = capsType;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index abc4ee82cb..9a779912fe 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -636,6 +636,8 @@ int virQEMUCapsGetCPUFeatures(virQEMUCapsPtr qemuCaps,
bool migratable,
char ***features);
+virDomainVirtType virQEMUCapsGetVirtType(virQEMUCapsPtr qemuCaps);
+
bool virQEMUCapsIsArchSupported(virQEMUCapsPtr qemuCaps,
virArch arch);
bool virQEMUCapsIsVirtTypeSupported(virQEMUCapsPtr qemuCaps,
--
2.20.1 (Apple Git-117)