From 1805fac3a7c8f99cc0d8929fdf70a45e6541c39d Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Thu, 14 Nov 2019 12:23:56 +0100 Subject: [PATCH] Use crm-command stop to allow shutdown with timeout and hard stop for HA Signed-off-by: Fabian Ebner --- PVE/API2/Qemu.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index c31dd1dc..8e162aaf 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -2111,7 +2111,7 @@ __PACKAGE__->register_method({ print "Requesting HA stop for VM $vmid\n"; - my $cmd = ['ha-manager', 'set', "vm:$vmid", '--state', 'stopped']; + my $cmd = ['ha-manager', 'crm-command', 'stop', "vm:$vmid", '0']; PVE::Tools::run_command($cmd); return; }; @@ -2267,12 +2267,13 @@ __PACKAGE__->register_method({ if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') { + my $timeout = $param->{timeout} // 60; my $hacmd = sub { my $upid = shift; print "Requesting HA stop for VM $vmid\n"; - my $cmd = ['ha-manager', 'set', "vm:$vmid", '--state', 'stopped']; + my $cmd = ['ha-manager', 'crm-command', 'stop', "vm:$vmid", "$timeout"]; PVE::Tools::run_command($cmd); return; };