From 7f4a5b5a6efab2812f8de96a9f8cc336d7b2895d Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 21 Aug 2012 11:39:17 +0200 Subject: [PATCH] fix bug #236: use correct shutdown timeout --- PVE/QemuServer.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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");