]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Extend libvirt-guests to shutdown only persistent VMs
authorBenjamin Taubmann <benjamin.taubmann@nutanix.com>
Tue, 26 Mar 2024 11:37:21 +0000 (11:37 +0000)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Apr 2024 07:10:00 +0000 (09:10 +0200)
commita39dd2571538513e23103b3b20526f84f01596a6
tree775df4012ce721cb1911e9aeca542458505811e3
parent5138dd247870c792d44e60d733ab2651ba9de4b4
Extend libvirt-guests to shutdown only persistent VMs

At the moment, there is no configuration option for the libvirt-guests
service that allows users to define that only persistent virtual machines
should be shutdown on host shutdown.

Currently, the service config allows to choose between two ON_SHUTDOWN
actions that are executed on running virtual machines when the host goes
down: shutdown, suspend.
The ON_SHUTDOWN action should be orthogonal to the type of the virtual
machine. However, the existing implementation, does not suspend
transient virtual machines.
This is the matrix of actions that is executed on virtual machines based
on the configured ON_SHUTDOWN action and the type of a virtual machine.

         | persistent | transient
shutdown | shutdown   | shutdown (what we want to change)
suspend  | suspend    | nothing

Add config option PERSISTENT_ONLY to libvirt-guests config that allows
users to define if the ON_SHUTDOWN action should be applied only on
persistent virtual machines. PERSISTENT_ONLY can be set to true, false,
default. The default option will implement the already existing logic.

Case 1: PERSISTENT_ONLY=default
         | persistent | transient
shutdown | shutdown   | shutdown
suspend  | suspend    | nothing

Case 2: PERSISTENT_ONLY=true
         | persistent | transient
shutdown | shutdown   | nothing
suspend  | suspend    | nothing

Case 3: PERSISTENT_ONLY=false
         | persistent | transient
shutdown | shutdown   | shutdown
suspend  | suspend    | suspend

Signed-off-by: Benjamin Taubmann <benjamin.taubmann@nutanix.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
docs/manpages/libvirt-guests.rst
tools/libvirt-guests.sh.in