mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-06-19 18:06:00 +00:00
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:
parent
8baf8bc77e
commit
1805fac3a7
@ -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;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user