[pve-devel] applied: [PATCH manager] api: ceph mgr list: check if active_name is really set

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jun 5 12:42:08 CEST 2019


As in a situation where we /had/ a manager but destroyed it this
key's value is a empty string, and if we pass that to the WebUI we
get strange results form of a ghost MGR entry with ExtJS auto-ID
generation as name -> pretty confusing.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/API2/Ceph/MGR.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Ceph/MGR.pm b/PVE/API2/Ceph/MGR.pm
index d8f5427d..c0e56085 100644
--- a/PVE/API2/Ceph/MGR.pm
+++ b/PVE/API2/Ceph/MGR.pm
@@ -69,7 +69,8 @@ __PACKAGE__->register_method ({
 
 	my $mgr_dump = $rados->mon_command({ prefix => 'mgr dump' });
 
-	$mgr_hash->{$mgr_dump->{active_name}}->{state} = 'active';
+	my $active_name = $mgr_dump->{active_name};
+	$mgr_hash->{$active_name}->{state} = 'active' if $active_name;
 
 	foreach my $mgr (@{$mgr_dump->{standbys}}) {
 	    $mgr_hash->{$mgr->{name}}->{state} = 'standby';
-- 
2.20.1





More information about the pve-devel mailing list