]> git.ipfire.org Git - thirdparty/libvirt.git/commit
rpc: don't let systemd shutdown daemon while saving VMs
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 7 Jan 2025 15:22:14 +0000 (15:22 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 20 Mar 2025 14:55:17 +0000 (14:55 +0000)
commit364977b94a776230037aa159be55bb95f2a33399
tree5d186bcfffca12d62d0b3152ecf67ebf3e9b93a6
parent27020d20eec5b7e3587a93be4a0abb1430bff90c
rpc: don't let systemd shutdown daemon while saving VMs

The service unit "TimeoutStopSec" setting controls how long systemd
waits for a service to stop before aggressively killing it, defaulting
to 30 seconds if not set.

When we're processing shutdown of VMs in response to OS shutdown, we
very likely need more than 30 seconds to complete this job, and can
not stop the daemon during this time.

To avoid being prematurely killed, setup a timer that repeatedly
extends the "TimeoutStopSec" value while stop of running VMs is
arranged.

This does mean if libvirt hangs while stoppping VMs, systemd won't
get to kill the libvirt daemon, but this is considered less harmful
that forcefully killing running VMs.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/rpc/virnetdaemon.c