[pve-devel] [PATCH qemu-server] Use new HA command to allow shutdown with timeout and stop

Fabian Ebner f.ebner at proxmox.com
Thu Sep 26 13:48:01 CEST 2019


This (obviously) depends on the patch series for the HA stop command.
With this the corresponding API calls to ha-manager are initiated;
previously everything resulted in "--state stopped" and therefore
a shutdown with 60 seconds timeout.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 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 3355c8b..84a3a17 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2150,7 +2150,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', 'stop',  "vm:$vmid", '0'];
 		PVE::Tools::run_command($cmd);
 		return;
 	    };
@@ -2306,12 +2306,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', 'stop', "vm:$vmid", "$timeout"];
 		PVE::Tools::run_command($cmd);
 		return;
 	    };
-- 
2.20.1





More information about the pve-devel mailing list