[pve-devel] [PATCH manager 1/4] ceph: osd list: add hostversions to the host nodes

Dominik Csapak d.csapak at proxmox.com
Fri Jul 19 10:17:00 CEST 2019


we want to improve the version hints in the osd tree gui and need
the version at the host nodes

we could (and want to) workaround it in the gui to have that
info for both versions of the api call

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Ceph/OSD.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index 3b432784..f3c808fb 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -104,6 +104,7 @@ __PACKAGE__->register_method ({
 
 	my $nodes = {};
 	my $newnodes = {};
+	my $hostversions = PVE::Cluster::get_node_kv("ceph-version");
 	foreach my $e (@{$res->{nodes}}) {
 	    $nodes->{$e->{id}} = $e;
 
@@ -165,6 +166,10 @@ __PACKAGE__->register_method ({
 	    } else {
 		$new->{leaf} = ($e->{id} >= 0) ? 1 : 0;
 	    }
+
+	    if ((my $name = $e->{name}) && $e->{type} eq 'host') {
+		$new->{version} = $hostversions->{$name};
+	    }
 	}
 
 	my $roots = [];
@@ -180,7 +185,7 @@ __PACKAGE__->register_method ({
 
 	# we want this for the noout flag
 	$data->{flags} = $flags if $flags;
-	$data->{versions} = PVE::Cluster::get_node_kv("ceph-version");
+	$data->{versions} = $hostversions; # for compatibility
 
 	return $data;
     }});
-- 
2.20.1





More information about the pve-devel mailing list