[pve-devel] [PATCH ha-manager 4/6] improve verbosity of API status call
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Feb 8 14:39:06 CET 2016
Display the state of a LRM when it is not in the "active" state
and has some service configured.
This should reduce confiusion when the LRM is active but still has
to wait for its lock. In such a case the user only sees that it's
active and could think it's malfunctioning because no action
happens.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
src/PVE/API2/HA/Status.pm | 5 +++++
src/PVE/HA/LRM.pm | 1 +
2 files changed, 6 insertions(+)
diff --git a/src/PVE/API2/HA/Status.pm b/src/PVE/API2/HA/Status.pm
index a7bdea8..34bcae4 100644
--- a/src/PVE/API2/HA/Status.pm
+++ b/src/PVE/API2/HA/Status.pm
@@ -110,6 +110,11 @@ __PACKAGE__->register_method ({
my $status_str = &$timestamp_to_status($ctime, $lrm_status->{timestamp});
my $time_str = localtime($lrm_status->{timestamp});
my $status_text = "$node ($status_str, $time_str)";
+ my $lrm_state = (PVE::HA::Tools::has_services($haenv, $node)) ?
+ $lrm_status->{state} : "idle";
+ $status_text .= " [$lrm_state]"
+ if $lrm_state && $lrm_state ne 'active';
+
push @$res, { id => $id, type => 'lrm', node => $node,
status => $status_text, timestamp => $lrm_status->{timestamp} };
}
diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index 217a8ad..8d7ce3f 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -115,6 +115,7 @@ sub update_lrm_status {
return 0 if !$haenv->quorate();
my $lrm_status = {
+ state => $self->{status}->{state},
mode => $self->{mode},
results => $self->{results},
timestamp => $haenv->get_time(),
--
2.1.4
More information about the pve-devel
mailing list