On Wed, Mar 12, 2025 at 17:17:45 +0000, Daniel P. Berrangé wrote:
Currently automatic VM managed save is only performed in session
daemons, on desktop session close, or host OS shutdown request.
With this change it is possible to control shutdown behaviour for
all daemons. A recommended setup might be:
auto_shutdown_try_save = "persistent"
auto_shutdown_try_shutdown = "all"
auto_shutdown_poweroff = "all"
Each setting accepts 'none', 'persistent', 'transient', and
'all'
to control what types of guest it applies to.
For historical compatibility, for the system daemon, the settings
currently default to:
auto_shutdown_try_save = "none"
auto_shutdown_try_shutdown = "none"
auto_shutdown_poweroff = "none"
while for the session daemon they currently default to
auto_shutdown_try_save = "persistent"
auto_shutdown_try_shutdown = "none"
auto_shutdown_poweroff = "none"
The system daemon settings should NOT be enabled if the traditional
libvirt-guests.service is already enabled.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/libvirtd_qemu.aug | 3 ++
src/qemu/qemu.conf.in | 42 +++++++++++++++++++
src/qemu/qemu_conf.c | 65 ++++++++++++++++++++++++++++++
src/qemu/qemu_conf.h | 4 ++
src/qemu/qemu_driver.c | 9 ++---
src/qemu/test_libvirtd_qemu.aug.in | 3 ++
6 files changed, 121 insertions(+), 5 deletions(-)
[...]
diff --git a/src/qemu/qemu.conf.in b/src/qemu/qemu.conf.in
index 31172303dc..a674e11388 100644
--- a/src/qemu/qemu.conf.in
+++ b/src/qemu/qemu.conf.in
@@ -639,6 +639,48 @@
#
#auto_start_delay = 0
+# The settings for auto shutdown actions accept one of
+# four possible options:
+#
+# * "none" - do not try to save any running VMs
+# * "persistent" - only try to save persistent running VMs
+# * "transient" - only try to save transient running VMs
+# * "all" - try to save all running VMs
+#
I'd suggest you change the commented-out empty line here to uncommented,
to separate the docs for auto_shutdown_try_save from the common section
above.
+# Whether to perform managed save of running VMs if a host OS
+# shutdown is requested (system/session daemons), or the desktop
+# session terminates (session daemon only).
+#
+# Defaults to "persistent" for session daemons and "none"
+# for system daemons. The values "all" and "transient" are
+# not permitted for this setting, since managed save is not
+# implemented for transient VMs.
+#
+# If 'libvirt-guests.service' is enabled, then this must be
+# set to 'none' for system daemons to avoid dueling actions
+#auto_shutdown_try_save = "persistent"
+
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>