]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
api/status: extra handling of maintenance mode
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 30 Nov 2019 18:46:47 +0000 (19:46 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 30 Nov 2019 18:46:47 +0000 (19:46 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/API2/HA/Status.pm

index 104f238de9fca30937aa00b1a28cdd25b2e9a180..6fd525bc299c89ab4693d20fdf71c05a69f5ab0a 100644 (file)
@@ -125,8 +125,10 @@ __PACKAGE__->register_method ({
                              status => "$node (unable to read lrm status)"};
            } else {
                my $status_str = &$timestamp_to_status($ctime, $lrm_status->{timestamp});
+               my $lrm_mode = $lrm_status->{mode};
+
                if ($status_str eq 'active') {
-                   my $lrm_mode = $lrm_status->{mode} || 'active';
+                   $lrm_mode ||= 'active';
                    my $lrm_state = $lrm_status->{state} || 'unknown';
                    if ($lrm_mode ne 'active') {
                        $status_str = "$lrm_mode mode";
@@ -137,6 +139,8 @@ __PACKAGE__->register_method ({
                            $status_str = $lrm_state;
                        }
                    }
+               } elsif ($lrm_mode && $lrm_mode eq 'maintenance') {
+                   $status_str = "$lrm_mode mode";
                }
 
                my $time_str = localtime($lrm_status->{timestamp});