[PATCH 13/24] qemu: capabilities: Fix testing of 'TCG' capabilities probing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The logic in 'virQEMUCapsInitQMP' invokes a second probe of qemu in case
when acceleration is used and TCG is supported to specifically probe the
CPU and features of non-accelerated guests.

The same logic must then be used in 'qemucapabilitiestest' when
replaying the data for testing otherwise the test would fail.

Export 'virQEMUCapsHaveAccel' for test usage and use the same logic
in 'testQemuCaps'.

Fix the comment in 'virQEMUCapsInitQMP' to outline what's happening.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 6 +++---
 src/qemu/qemu_capspriv.h     | 3 +++
 tests/qemucapabilitiestest.c | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 22b0d2ca86..9a310a0f2d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -883,7 +883,7 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type)
 }


-static bool
+bool
 virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps)
 {
     return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) ||
@@ -5751,8 +5751,8 @@ virQEMUCapsInitQMP(virQEMUCaps *qemuCaps,
         return -1;

     /*
-     * If KVM was enabled during the first probe, we need to explicitly probe
-     * for TCG capabilities by asking the same binary again and turning KVM
+     * If acceleration was enabled during the first probe, we need to explicitly
+     * probe for TCG capabilities by asking the same binary again and turning KVM
      * off.
      */
     if (virQEMUCapsHaveAccel(qemuCaps) &&
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index 60fdf02f06..be83b13ab5 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -116,3 +116,6 @@ virQEMUCapsAddMachine(virQEMUCaps *qemuCaps,
                       const char *defaultRAMid,
                       bool deprecated,
                       virTristateBool acpi);
+
+bool
+virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps);
diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
index 081f14a6c3..7575f9fd44 100644
--- a/tests/qemucapabilitiestest.c
+++ b/tests/qemucapabilitiestest.c
@@ -101,7 +101,8 @@ testQemuCaps(const void *opaque)
     if (virQEMUCapsInitQMPMonitor(capsActual, qemuMonitorTestGetMonitor(mon)) < 0)
         return -1;

-    if (virQEMUCapsGet(capsActual, QEMU_CAPS_KVM)) {
+    if (virQEMUCapsHaveAccel(capsActual) &&
+        virQEMUCapsGet(capsActual, QEMU_CAPS_TCG)) {
         qemuMonitorResetCommandID(qemuMonitorTestGetMonitor(mon));

         if (qemuProcessQMPInitMonitor(qemuMonitorTestGetMonitor(mon)) < 0)
-- 
2.39.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux