The function should be used to check if qemu capabilities include a
hardware acceleration, i.e. QEMU accel is not TCG.
Signed-off-by: Roman Bolshakov <r.bolshakov(a)yadro.com>
---
src/qemu/qemu_capabilities.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index eb3148038a..648e5bd585 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -636,6 +636,12 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type)
return type == VIR_DOMAIN_VIRT_KVM;
}
+static bool
+virQEMUCapsHaveAccel(virQEMUCapsPtr qemuCaps)
+{
+ return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM);
+}
+
/* Checks whether a domain with @guest arch can run natively on @host.
*/
bool
@@ -2365,7 +2371,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
if (!(models = virQEMUCapsFetchCPUDefinitions(mon)))
return -1;
- if (tcg || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
+ if (tcg || !virQEMUCapsHaveAccel(qemuCaps))
qemuCaps->tcgCPUModels = models;
else
qemuCaps->accelCPUModels = models;
@@ -2391,7 +2397,7 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps,
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
return 0;
- if (tcg || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
+ if (tcg || !virQEMUCapsHaveAccel(qemuCaps)) {
virtType = VIR_DOMAIN_VIRT_QEMU;
model = "max";
} else {
@@ -4495,7 +4501,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
if (virQEMUCapsInitQMPMonitor(qemuCaps, cmd->mon) < 0)
goto cleanup;
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
+ if (virQEMUCapsHaveAccel(qemuCaps)) {
virQEMUCapsInitQMPCommandAbort(cmd);
if ((rc = virQEMUCapsInitQMPCommandRun(cmd, true)) != 0) {
if (rc == 1)
--
2.17.1 (Apple Git-112)