]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch: Make sure the cloud-hypervisor process is killed in virCHProcessStop()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 9 Sep 2025 10:49:30 +0000 (12:49 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Sep 2025 06:34:52 +0000 (08:34 +0200)
Currently, virCHProcessStop() is called either when the
cloud-hypervisor process dies gracefully (e.g. on shutdown
initiated from within the guest) or when virDomainDestroy() is
called (or on failed start attempt, but that's not important
right now).

At any rate, if the cloud-hypervisor process is running it's not
a child process of libvirtd rather than the init (per
virCommandDaemonize() called inside of virCHMonitorNew()). This
distinction is important because virCHProcessStop() then calls
virProcessAbort() thinking it'll kill the process. Well,
virProcessAbort() works only on child processes.

Switch to virProcessKillPainfully() which does work in such
cases.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/ch/ch_process.c

index 5195d3f5da46e2c6cf4a7d97f0366bbd7e26426e..6b779285e1e2e6ad6a8e3d947352dddd3aa8bf9f 100644 (file)
@@ -1028,7 +1028,7 @@ virCHProcessStop(virCHDriver *driver,
     virErrorPreserveLast(&orig_err);
 
     if (priv->monitor) {
-        virProcessAbort(vm->pid);
+        virProcessKillPainfully(vm->pid, true);
         g_clear_pointer(&priv->monitor, virCHMonitorClose);
     }