ch: Make sure the cloud-hypervisor process is killed in virCHProcessStop()

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>
This commit is contained in:
Michal Privoznik committed 2025-09-10 08:34:52 +02:00
1 parent 5a89be0611
commit fc56f7279f
1 file changed
+1 -1
+1 -1
View 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);
}