]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_process: Be nicer to killing QEMU when probing caps
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Feb 2022 09:33:20 +0000 (10:33 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 18 Mar 2022 16:00:06 +0000 (17:00 +0100)
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@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_process.c

index 7931eeb23b8ae5bc0d3ed1125a87eae5ddbae0f5..1ed60917ead8b3d8bc63384d5d208a8355634681 100644 (file)
@@ -9131,11 +9131,8 @@ 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);
+        virResetLastError();
         proc->pid = 0;
     }