[pve-devel] [PATCH ha-manager] mark CRM as idle if no service is configured

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Mar 14 10:34:26 CET 2016


This should avoid confusion if we remove all service from the CRM,
as else we would always see "old timestamp -dead?" in the status.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

Also made a whitespace cleanup in the diff context.

 src/PVE/API2/HA/Status.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/API2/HA/Status.pm b/src/PVE/API2/HA/Status.pm
index 3ce8d23..1d83565 100644
--- a/src/PVE/API2/HA/Status.pm
+++ b/src/PVE/API2/HA/Status.pm
@@ -94,11 +94,13 @@ __PACKAGE__->register_method ({
 	if (defined($status->{master_node}) && defined($status->{timestamp})) {
 	    my $master = $status->{master_node};
 	    my $status_str = &$timestamp_to_status($ctime, $status->{timestamp});
+	    # mark crm idle if no service is configured to avoid confusion
+	    $status_str = 'idle' if %{$status->{service_status}} == 0;
 	    my $time_str = localtime($status->{timestamp});
 	    my $status_text = "$master ($status_str, $time_str)";
-	    push @$res, { id => 'master', type => 'master', node => $master, 
+	    push @$res, { id => 'master', type => 'master', node => $master,
 			  status => $status_text, timestamp => $status->{timestamp} };
-	} 
+	}
 
 	# compute active services for all nodes
 	my $active_count = {};
-- 
2.1.4





More information about the pve-devel mailing list