[pve-devel] [PATCH manager] Fix #936: ceph: support multiple roots in osd tree

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Apr 12 09:56:04 CEST 2016


The OSD tree in our GUI otherwise only shows the "first"
root it finds in the crush map.
---
 PVE/API2/Ceph.pm | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 786eecf..b0bf61e 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -138,17 +138,16 @@ __PACKAGE__->register_method ({
 	    }
 	}
 
-	my $rootnode;
+	my $roots = [];
 	foreach my $e (@{$res->{nodes}}) {
 	    if (!$nodes->{$e->{id}}->{parent}) {
-		$rootnode = $newnodes->{$e->{id}};
-		last;
+		push @$roots, $newnodes->{$e->{id}};
 	    }
 	}
 
-	die "no root node\n" if !$rootnode;
+	die "no root node\n" if !@$roots;
 
-	my $data = { root => $rootnode };
+	my $data = { root => { leaf =>  0, children => $roots } };
 
 	return $data;
     }});
-- 
2.1.4




More information about the pve-devel mailing list