From 77bcb60a9d25784f7ee2c1eff4b57636c6891f89 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sat, 30 Nov 2019 19:46:47 +0100 Subject: [PATCH] api/status: extra handling of maintenance mode Signed-off-by: Thomas Lamprecht --- src/PVE/API2/HA/Status.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PVE/API2/HA/Status.pm b/src/PVE/API2/HA/Status.pm index 104f238..6fd525b 100644 --- a/src/PVE/API2/HA/Status.pm +++ b/src/PVE/API2/HA/Status.pm @@ -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}); -- 2.39.2