In order to not affect running VMs, refreshing the halted state
is only performed if QEMU supports the query-cpus-fast QAPI.

Signed-off-by: Viktor Mihajlovski <mihaj...@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiu...@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhart...@linux.vnet.ibm.com>
---
 src/qemu/qemu_domain.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 662937b..0331af7 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9124,8 +9124,13 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
         return 0;
 
     /* The halted state is interresting only on s390(x). On other platforms
-     * the data would be stale at the time when it would be used. */
-    if (!ARCH_IS_S390(vm->def->os.arch))
+     * the data would be stale at the time when it would be used.
+     * Calling qemuMonitorGetCpuHalted() can adversely affect the running
+     * VM's performance unless QEMU supports query-cpus-fast.
+     */
+    if (!ARCH_IS_S390(vm->def->os.arch) ||
+        !virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
+                        QEMU_CAPS_QUERY_CPUS_FAST))
         return 0;
 
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
-- 
1.9.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to