
On Wed, Jan 08, 2025 at 19:42:46 +0000, Daniel P. Berrangé wrote:
Allow users to control how many seconds libvirt waits for QEMU shutdown before force powering off a guest.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf.in | 4 ++++ src/qemu/qemu_conf.c | 4 ++++ src/qemu/qemu_conf.h | 1 + src/qemu/qemu_driver.c | 1 + src/qemu/test_libvirtd_qemu.aug.in | 1 + 6 files changed, 12 insertions(+)
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index 605604a01a..8cb1b144b9 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -101,6 +101,7 @@ module Libvirtd_qemu = | str_entry "auto_shutdown_try_save" | str_entry "auto_shutdown_try_shutdown" | str_entry "auto_shutdown_poweroff" + | int_entry "auto_shutdown_wait"
let process_entry = str_entry "hugetlbfs_mount" | str_entry "bridge_helper" diff --git a/src/qemu/qemu.conf.in b/src/qemu/qemu.conf.in index 82eae2eecd..9287196c42 100644 --- a/src/qemu/qemu.conf.in +++ b/src/qemu/qemu.conf.in @@ -677,6 +677,10 @@ # set to 'none' for system daemons to avoid dueling actions #auto_shutdown_poweroff = "all"
+# How may seconds to wait for running VMs to gracefully shutdown +# when 'auto_shutdown_try_shutdown' is enabled +#auto_shutdown_wait = 30
This does say what the default is, but doesn't make it clear that 0 will be converted to 30, while 1 will not.
+ # If provided by the host and a hugetlbfs mount point is configured, # a guest may request huge page backing. When this mount point is # unspecified here, determination of a host mount point in /proc/mounts diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 76bb3bd888..7ec682e533 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -692,6 +692,10 @@ virQEMUDriverConfigLoadSaveEntry(virQEMUDriverConfig *cfg, return -1; }
+ if (virConfGetValueInt(conf, "auto_shutdown_wait", + &cfg->autoShutdownWait) < 0) + return -1; + return 0; }
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 5d9ace6dcc..b8f6be110d 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -204,6 +204,7 @@ struct _virQEMUDriverConfig { int autoShutdownTrySave; int autoShutdownTryShutdown; int autoShutdownPoweroff; + int autoShutdownWait;
Consider using unsigned as negative 'wait' doesn't make sense.
char *lockManagerName;
With the description clearly mentioning that 0 will not work: Reviewed-by: Peter Krempa <pkrempa@redhat.com>