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 0EAD97C997
 for <pve-devel@lists.proxmox.com>; Fri,  5 Nov 2021 15:23:49 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 042ADDDFF
 for <pve-devel@lists.proxmox.com>; Fri,  5 Nov 2021 15:23:49 +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) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 8B28BDDF6
 for <pve-devel@lists.proxmox.com>; Fri,  5 Nov 2021 15:23:48 +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 650F1468D8
 for <pve-devel@lists.proxmox.com>; Fri,  5 Nov 2021 15:23:48 +0100 (CET)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Fri,  5 Nov 2021 15:23:47 +0100
Message-Id: <20211105142347.2746122-1-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.236 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
Subject: [pve-devel] [PATCH manager] ceph: fix version check shortcut
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: Fri, 05 Nov 2021 14:23:49 -0000

with 'get_node_kv', we get a hash which contains the value for
all nodes in the cluster (with the nodename as key), so we have to use
the value from the hash corresponding to our nodename.

also the 'str' property is inside the 'version' hash

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
i noticed on my ceph cluster many warnings from pvestatd, because of this
 PVE/Ceph/Services.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/Ceph/Services.pm b/PVE/Ceph/Services.pm
index ad41dbe4..5340f5fc 100644
--- a/PVE/Ceph/Services.pm
+++ b/PVE/Ceph/Services.pm
@@ -52,9 +52,10 @@ sub broadcast_ceph_versions {
 
     if ($version) {
 	if (my $old = PVE::Cluster::get_node_kv("ceph-versions")) {
-	    $old = eval { decode_json($old) };
+	    my $nodename = PVE::INotify::nodename();
+	    $old = eval { decode_json($old->{$nodename}) };
 	    warn $@ if $@; # should not happen
-	    if (defined($old) && $old->{buildcommit} eq $buildcommit && $old->{str} eq $version) {
+	    if (defined($old) && $old->{buildcommit} eq $buildcommit && $old->{version}->{str} eq $version) {
 		return; # up to date, nothing to do so avoid (not exactly cheap) broadcast
 	    }
 	}
-- 
2.30.2