[PATCH 1/2] qemu_process: Be nicer to killing QEMU when probing caps

Michal Privoznik mprivozn at redhat.com
Fri Feb 4 15:38:40 UTC 2022


The qemuProcessQMPStop() function is intended to kill this dummy
QEMU process we started only for querying capabilities.
Nevertheless, it may be not plain QEMU binary we executed, but
in fact it may be a memcheck tool (e.g. valgrind) that executes
QEMU later. By switching to virProcessKillPainfully() we allow
this wrapper tool to exit gracefully.

Another up side is that virProcessKillPainfully() reports an
error so no need for us to VIR_ERROR() ourselves.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_process.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ea586e54c1..bb7d02f6c7 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -9095,11 +9095,7 @@ qemuProcessQMPStop(qemuProcessQMP *proc)
 
     if (proc->pid != 0) {
         VIR_DEBUG("Killing QMP caps process %lld", (long long)proc->pid);
-        if (virProcessKill(proc->pid, SIGKILL) < 0 && errno != ESRCH)
-            VIR_ERROR(_("Failed to kill process %lld: %s"),
-                      (long long)proc->pid,
-                      g_strerror(errno));
-
+        virProcessKillPainfully(proc->pid, true);
         proc->pid = 0;
     }
 
-- 
2.34.1




More information about the libvir-list mailing list