From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 3E2B27E3D1
 for <pve-devel@lists.proxmox.com>; Wed, 10 Nov 2021 13:16:28 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 352F01B688
 for <pve-devel@lists.proxmox.com>; Wed, 10 Nov 2021 13:15:58 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 51EA61B675
 for <pve-devel@lists.proxmox.com>; Wed, 10 Nov 2021 13:15:57 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 253EC40DAB
 for <pve-devel@lists.proxmox.com>; Wed, 10 Nov 2021 13:15:57 +0100 (CET)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed, 10 Nov 2021 13:15:55 +0100
Message-Id: <20211110121556.500448-2-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20211110121556.500448-1-d.csapak@proxmox.com>
References: <20211110121556.500448-1-d.csapak@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.228 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [osd.pm, ceph.pm]
Subject: [pve-devel] [PATCH manager 1/2] api: ceph: fix getting ceph versions
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 10 Nov 2021 12:16:28 -0000

since commit:
fb0cb9b7 ("ceph services: drop broadcasting legacy version pmxcfs KV")

the 'ceph-version' kv is not broadcasted anymore, so we should not query it.
instead use get_ceph_versions

also drop the other legacy keys for the versions

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

diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index fbbc2139..a8f48304 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -106,7 +106,7 @@ __PACKAGE__->register_method ({
 	my $osdmetadata_res = $rados->mon_command({ prefix => 'osd metadata' });
 	my $osdmetadata = { map { $_->{id} => $_ } @$osdmetadata_res };
 
-	my $hostversions = PVE::Cluster::get_node_kv("ceph-version");
+	my $hostversions = PVE::Ceph::Services::get_ceph_versions();
 
 	my $nodes = {};
 	my $newnodes = {};
@@ -176,7 +176,7 @@ __PACKAGE__->register_method ({
 	    }
 
 	    if ($name && $e->{type} eq 'host') {
-		$new->{version} = $hostversions->{$name};
+		$new->{version} = $hostversions->{$name}->{version}->{str};
 	    }
 	}
 
@@ -195,7 +195,6 @@ __PACKAGE__->register_method ({
 		leaf =>  0,
 		children => $realroots
 	    },
-	    versions => $hostversions, # for compatibility
 	};
 
 	$data->{flags} = $flags if $flags; # we want this for the noout flag
diff --git a/PVE/API2/Cluster/Ceph.pm b/PVE/API2/Cluster/Ceph.pm
index 1cc5aff4..7f825003 100644
--- a/PVE/API2/Cluster/Ceph.pm
+++ b/PVE/API2/Cluster/Ceph.pm
@@ -74,10 +74,7 @@ __PACKAGE__->register_method ({
 
 	my $scope = $param->{scope} // 'all';
 
-	my $res = {
-	    # FIXME: remove with 7.0 depreacated by structured 'versions'
-	    version => PVE::Cluster::get_node_kv("ceph-version"),
-	};
+	my $res = {};
 
 	if (defined(my $versions = PVE::Ceph::Services::get_ceph_versions())) {
 	    $res->{node} = $versions;
-- 
2.30.2