[pve-devel] [PATCH v2 container] Use crm-command stop to allow shutdown with timeout and hard stop for HA

Fabian Ebner f.ebner at proxmox.com
Thu Nov 14 12:23:57 CET 2019


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Changes from v1:
    * don't change the API

 src/PVE/API2/LXC/Status.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/API2/LXC/Status.pm b/src/PVE/API2/LXC/Status.pm
index 1b7a71d..166c731 100644
--- a/src/PVE/API2/LXC/Status.pm
+++ b/src/PVE/API2/LXC/Status.pm
@@ -243,7 +243,7 @@ __PACKAGE__->register_method({
 
 		print "Requesting HA stop for CT $vmid\n";
 
-		my $cmd = ['ha-manager', 'set',  "ct:$vmid", '--state', 'stopped'];
+		my $cmd = ['ha-manager', 'crm-command', 'stop', "ct:$vmid", '0'];
 		PVE::Tools::run_command($cmd);
 	    };
 
@@ -325,7 +325,7 @@ __PACKAGE__->register_method({
 
 		print "Requesting HA stop for CT $vmid\n";
 
-		my $cmd = ['ha-manager', 'set',  "ct:$vmid", '--state', 'stopped'];
+		my $cmd = ['ha-manager', 'crm-command', 'stop',  "ct:$vmid", "$timeout"];
 		PVE::Tools::run_command($cmd);
 	    };
 
-- 
2.20.1





More information about the pve-devel mailing list