diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 449de751..9194bc3a 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2907,8 +2907,6 @@ sub vm_stop_cleanup { sub vm_stop { my ($storecfg, $vmid, $skiplock, $nocheck, $timeout, $shutdown, $force, $keepActive) = @_; - $timeout = 60 if !defined($timeout); - $force = 1 if !defined($force) && !$shutdown; lock_config($vmid, sub { @@ -2920,8 +2918,14 @@ sub vm_stop { if (!$nocheck) { $conf = load_config($vmid); check_lock($conf) if !$skiplock; + if (!defined($timeout) && $shutdown && $conf->{startup}) { + my $opts = parse_startup($conf->{startup}); + $timeout = $opts->{down} if $opts->{down}; + } } + $timeout = 60 if !defined($timeout); + eval { if ($shutdown) { $nocheck ? vm_mon_cmd_nocheck($vmid, "system_powerdown") : vm_mon_cmd($vmid, "system_powerdown");