]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: improve shutdown defaults for session daemon
authorDaniel P. Berrangé <berrange@redhat.com>
Fri, 20 Dec 2024 17:32:49 +0000 (17:32 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 20 Mar 2025 14:55:17 +0000 (14:55 +0000)
Currently the session daemon will try a managed save on all VMs,
leaving them running if that fails.

This limits the managed save just to persistent VMs, as there will
usually not be any way to restore transient VMs later.

It also enables graceful shutdown and then forced poweroff, should
save fail for some reason.

These new defaults can be overridden in the config file if needed.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu.conf.in
src/qemu/qemu_conf.c
src/qemu/test_libvirtd_qemu.aug.in

index ea7f905485e8b930ca4e0c7d5ec2f770e61d50e4..a948b8c07e23db7b8d5d27e583a95cc6101291de 100644 (file)
 # managed save. If managed save is enabled, shutdown will
 # be tried only on failure to perform managed save.
 #
-# Defaults to "none"
+# Defaults to "all" for session daemons and "none" for
+# system daemons
 #
 # If 'libvirt-guests.service' is enabled, then this must be
 # set to 'none' for system daemons to avoid dueling actions
-#auto_shutdown_try_shutdown = "none"
+#auto_shutdown_try_shutdown = "all"
 
 # As above, but with a forced poweroff instead of managed
 # save. If managed save or graceful shutdown are enabled,
 # forced poweroff will be tried only on failure of the
 # other options.
 #
-# Defaults to "none"
+# Defaults to "all" for session daemons and "none" for
+# system daemons.
 #
 # If 'libvirt-guests.service' is enabled, then this must be
 # set to 'none' for system daemons to avoid dueling actions
-#auto_shutdown_poweroff = "none"
+#auto_shutdown_poweroff = "all"
 
 # If provided by the host and a hugetlbfs mount point is configured,
 # a guest may request huge page backing.  When this mount point is
index f0b0749259ae313cfbba97b237caa0935f74dd57..23b2e34cb3ac40edc04906ee542d28770aff67e7 100644 (file)
@@ -325,8 +325,8 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
         cfg->autoShutdownPoweroff = VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOPE_NONE;
     } else {
         cfg->autoShutdownTrySave = VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOPE_PERSISTENT;
-        cfg->autoShutdownTryShutdown = VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOPE_NONE;
-        cfg->autoShutdownPoweroff = VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOPE_NONE;
+        cfg->autoShutdownTryShutdown = VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOPE_ALL;
+        cfg->autoShutdownPoweroff = VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOPE_ALL;
     }
 
     return g_steal_pointer(&cfg);
index 9dd5fdb1d9b82fe55d3b3cdd0a714ad0450e02e0..0dc42ca27047d708d715da699a5ce9717fd8e33e 100644 (file)
@@ -81,8 +81,8 @@ module Test_libvirtd_qemu =
 { "auto_start_bypass_cache" = "0" }
 { "auto_start_delay" = "0" }
 { "auto_shutdown_try_save" = "persistent" }
-{ "auto_shutdown_try_shutdown" = "none" }
-{ "auto_shutdown_poweroff" = "none" }
+{ "auto_shutdown_try_shutdown" = "all" }
+{ "auto_shutdown_poweroff" = "all" }
 { "hugetlbfs_mount" = "/dev/hugepages" }
 { "bridge_helper" = "qemu-bridge-helper" }
 { "set_process_name" = "1" }