From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] ceph: services: broadcast versions: improve requesting old version
Date: Tue, 30 Nov 2021 11:38:12 +0100 [thread overview]
Message-ID: <20211130103812.58366-1-f.ebner@proxmox.com> (raw)
to avoid a "malformed JSON string" warning when there is no old
version present (e.g. after starting a cluster).
get_node_kv will always return something that evaluates to true, so
instead, test if the result has an entry for the current node. Also,
it's enough to request the kv for the current node only.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
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 cda13c6a..e0f31e8e 100644
--- a/PVE/Ceph/Services.pm
+++ b/PVE/Ceph/Services.pm
@@ -51,8 +51,9 @@ sub broadcast_ceph_versions {
my ($version, $buildcommit, $vers_parts) = PVE::Ceph::Tools::get_local_version(1);
if ($version) {
- if (my $old = PVE::Cluster::get_node_kv("ceph-versions")) {
- my $nodename = PVE::INotify::nodename();
+ my $nodename = PVE::INotify::nodename();
+ my $old = PVE::Cluster::get_node_kv("ceph-versions", $nodename);
+ if (defined($old->{$nodename})) {
$old = eval { decode_json($old->{$nodename}) };
warn $@ if $@; # should not happen
if (defined($old) && $old->{buildcommit} eq $buildcommit && $old->{version}->{str} eq $version) {
--
2.30.2
next reply other threads:[~2021-11-30 10:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 10:38 Fabian Ebner [this message]
2022-03-10 7:50 ` Fabian Ebner
2022-04-26 6:30 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211130103812.58366-1-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox