5
0
mirror of git://git.proxmox.com/git/pve-ha-manager.git synced 2025-03-10 16:58:16 +03:00

crm: get active if there are nodes that need to leave maintenance

This is mostly cosmetic, because as long as there are configured
services a CRM would get active anyway. But it can happen that a
maintenance mode is left-over and all services got removed a fresh
cluster start then will keep all CRMs as idle and thus never clear the
maintenance state.

This can be especially confusing now, as a recent pve-manager commit
993d05abc ("api/ui: include the node ha status in resources call and
show as icon") started to show the maintenance mode as icon in the web
UI, thus making this blip much more prominent.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2024-11-17 17:23:01 +01:00
parent 73f93a4f6b
commit 977ae28849
2 changed files with 16 additions and 0 deletions

View File

@ -5,6 +5,8 @@ package PVE::HA::CRM;
use strict;
use warnings;
use List::Util qw(any);
use PVE::Tools;
use PVE::HA::Tools;
@ -189,6 +191,17 @@ sub can_get_active {
|| $manager_status->{node_status}->{$active_master_node} ne 'online'
|| $active_master_node eq $haenv->nodename()
) {
my $ns = $manager_status->{node_status};
for my $node (keys $ns->%*) {
next if $ns->{$node} ne 'maintenance';
if (
!$manager_status->{node_request}
|| !$manager_status->{node_request}->{$node}
|| !$manager_status->{node_request}->{$node}->{maintenance}
) {
return 1;
}
}
if ($haenv->any_pending_crm_command()) {
return 1; # process pending CRM commands
}

View File

@ -8,5 +8,8 @@ info 20 node2/lrm: status change startup => wait_for_agent_lock
info 20 cmdlist: execute power node3 on
info 20 node3/crm: status change startup => wait_for_quorum
info 20 node3/lrm: status change startup => wait_for_agent_lock
info 20 node1/crm: got lock 'ha_manager_lock'
info 20 node1/crm: status change wait_for_quorum => master
info 20 node1/crm: node 'node2': state changed from 'maintenance' => 'online'
info 120 cmdlist: execute delay 0
info 720 hardware: exit simulation - done