Use crm-command stop to allow shutdown with timeout and hard stop for HA

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2019-11-14 12:23:56 +01:00 committed by Thomas Lamprecht
parent 8baf8bc77e
commit 1805fac3a7

View File

@ -2111,7 +2111,7 @@ __PACKAGE__->register_method({
print "Requesting HA stop for VM $vmid\n"; 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); PVE::Tools::run_command($cmd);
return; return;
}; };
@ -2267,12 +2267,13 @@ __PACKAGE__->register_method({
if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') { if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
my $timeout = $param->{timeout} // 60;
my $hacmd = sub { my $hacmd = sub {
my $upid = shift; my $upid = shift;
print "Requesting HA stop for VM $vmid\n"; 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); PVE::Tools::run_command($cmd);
return; return;
}; };