[pve-devel] [PATCH ha-manager] status: show added but not yet active services
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Mar 15 12:40:51 CET 2016
If the CRM is dead or not active yet and we add a new service, we do
not see it in the HA status. This can be confusing for the user as
it is queued for adding but does not shows up, so lets show those
services also.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
changes since v2:
* do not delete elements from service_config hash, it's bad style
src/PVE/API2/HA/Status.pm | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/PVE/API2/HA/Status.pm b/src/PVE/API2/HA/Status.pm
index 252cd78..682c2ab 100644
--- a/src/PVE/API2/HA/Status.pm
+++ b/src/PVE/API2/HA/Status.pm
@@ -151,10 +151,19 @@ __PACKAGE__->register_method ({
foreach my $sid (sort keys %{$status->{service_status}}) {
my $d = $status->{service_status}->{$sid};
- push @$res, { id => "service:$sid", type => 'service', sid => $sid,
+ push @$res, { id => "service:$sid", type => 'service', sid => $sid,
node => $d->{node}, status => "$sid ($d->{node}, $d->{state})" };
}
-
+
+ # show also service which aren't yet processed by the CRM
+ foreach my $sid (sort keys %$service_config) {
+ next if $status->{service_status}->{$sid};
+ my $d = $service_config->{$sid};
+ push @$res, { id => "service:$sid", type => 'service', sid => $sid,
+ status => "$sid ($d->{node}, queued)",
+ node => $d->{node} };
+ }
+
return $res;
}});
--
2.1.4
More information about the pve-devel
mailing list