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

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

 



On Wed, Mar 16, 2022 at 04:39:35PM +0100, Michal Privoznik wrote:
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@xxxxxxxxxx>
---
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 b19a6218d0..2e149699b0 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -9132,11 +9132,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);

Unfortunately this uses virReportError(), so shouldn't we clear the
error since this function is void?  If yes and you add the reset here,
then

Reviewed-by: Martin Kletzander <mkletzan@xxxxxxxxxx>

        proc->pid = 0;
    }

--
2.34.1

Attachment: signature.asc
Description: PGP signature


[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