1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-30 18:50:18 +03:00

qemu: configurable delay for shutdown before poweroff

Allow users to control how many seconds libvirt waits for QEMU
shutdown before force powering off a guest.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2024-12-19 19:13:04 +00:00
parent eb51f97870
commit faa7a082a1
6 changed files with 14 additions and 0 deletions

View File

@ -106,6 +106,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"

View File

@ -708,6 +708,12 @@
# 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. If set to 0
# then an arbitrary built-in default value will be used (which
# is currently 30 secs)
#auto_shutdown_wait = 30
# 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

View File

@ -763,6 +763,10 @@ virQEMUDriverConfigLoadSaveEntry(virQEMUDriverConfig *cfg,
cfg->autoShutdownPoweroff = autoShutdownVal;
}
if (virConfGetValueUInt(conf, "auto_shutdown_wait",
&cfg->autoShutdownWait) < 0)
return -1;
return 0;
}

View File

@ -215,6 +215,7 @@ struct _virQEMUDriverConfig {
virDomainDriverAutoShutdownScope autoShutdownTrySave;
virDomainDriverAutoShutdownScope autoShutdownTryShutdown;
virDomainDriverAutoShutdownScope autoShutdownPoweroff;
unsigned int autoShutdownWait;
char *lockManagerName;

View File

@ -969,6 +969,7 @@ qemuStateStop(void)
.trySave = cfg->autoShutdownTrySave,
.tryShutdown = cfg->autoShutdownTryShutdown,
.poweroff = cfg->autoShutdownPoweroff,
.waitShutdownSecs = cfg->autoShutdownWait,
};
virDomainDriverAutoShutdown(&ascfg);

View File

@ -83,6 +83,7 @@ module Test_libvirtd_qemu =
{ "auto_shutdown_try_save" = "persistent" }
{ "auto_shutdown_try_shutdown" = "all" }
{ "auto_shutdown_poweroff" = "all" }
{ "auto_shutdown_wait" = "30" }
{ "hugetlbfs_mount" = "/dev/hugepages" }
{ "bridge_helper" = "qemu-bridge-helper" }
{ "set_process_name" = "1" }