[pve-devel] [PATCH manager 1/3] ceph: a little luminous backwards compatibility

Dominik Csapak d.csapak at proxmox.com
Tue Jun 11 11:14:22 CEST 2019


ceph luminous does not use the 'name' property in the metadata
everywhere, so fall back to 'id'

this makes the ceph dashboard usable while having still luminous
(relevant for upgrading)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Cluster.pm  | 2 +-
 PVE/Ceph/Services.pm | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index bfdd9ad1..74806484 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -664,7 +664,7 @@ __PACKAGE__->register_method ({
 	    my $services = $rados->mon_command({ prefix => "$type metadata" });
 	    for my $service ( @$services ) {
 		my $hostname = $service->{hostname};
-		my $servicename =  $service->{name};
+		my $servicename =  $service->{name} // $service->{id};
 		my $id = "$servicename\@$hostname";
 
 		if ($data->{$id}) {
diff --git a/PVE/Ceph/Services.pm b/PVE/Ceph/Services.pm
index 208deca1..1a980136 100644
--- a/PVE/Ceph/Services.pm
+++ b/PVE/Ceph/Services.pm
@@ -111,7 +111,8 @@ sub get_services_info {
     }
     my $metadata = $rados->mon_command({ prefix => "$type metadata" });
     foreach my $info (@$metadata) {
-	my $service = $result->{$info->{name}};
+	my $id = $info->{name} // $info->{id};
+	my $service = $result->{$id};
 	$service->{ceph_version_short} = $info->{ceph_version_short};
 	$service->{ceph_version} = $info->{ceph_version};
 	$service->{host} //= $info->{hostname};
-- 
2.11.0





More information about the pve-devel mailing list