From 00ea049daa728f3c174aa1c3293b7bf4f6cd1d74 Mon Sep 17 00:00:00 2001 From: Tobin Feldman-Fitzthum Date: Wed, 22 Apr 2020 17:50:42 -0400 Subject: [PATCH] qemu: Fix capabilities probing with TCG Only probe QEMU binary with accel=tcg if TCG is not disabled. Similarly, only add a VIR_DOMAIN_VIRT_QEMU guest if TCG is available. Signed-off-by: Tobin Feldman-Fitzthum Signed-off-by: Michal Privoznik Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4a6662b31f..2c63506214 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1021,13 +1021,16 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, virCapabilitiesAddGuestFeatureWithToggle(guest, VIR_CAPS_GUEST_FEATURE_TYPE_DISKSNAPSHOT, true, false); - if (virCapabilitiesAddGuestDomain(guest, - VIR_DOMAIN_VIRT_QEMU, - NULL, - NULL, - 0, - NULL) == NULL) - goto cleanup; + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_TCG)) { + if (virCapabilitiesAddGuestDomain(guest, + VIR_DOMAIN_VIRT_QEMU, + NULL, + NULL, + 0, + NULL) == NULL) { + goto cleanup; + } + } if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { if (virCapabilitiesAddGuestDomain(guest, @@ -2307,7 +2310,8 @@ bool virQEMUCapsIsVirtTypeSupported(virQEMUCapsPtr qemuCaps, virDomainVirtType virtType) { - if (virtType == VIR_DOMAIN_VIRT_QEMU) + if (virtType == VIR_DOMAIN_VIRT_QEMU && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_TCG)) return true; if (virtType == VIR_DOMAIN_VIRT_KVM && @@ -5166,6 +5170,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps, * off. */ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_TCG) && virQEMUCapsInitQMPSingle(qemuCaps, libDir, runUid, runGid, true) < 0) return -1; -- GitLab