public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] pvestatd: rebroadcast version info as needed
Date: Fri, 12 Nov 2021 13:23:53 +0100	[thread overview]
Message-ID: <20211112122353.111086-1-w.bumiller@proxmox.com> (raw)

since this is just in-memory data and can get lost with
pmxcfs restarts

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: 34a1305e9c21 ("pvestatd: broadcast version info")
---
 PVE/Service/pvestatd.pm | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
index b1e71ec8..6a413025 100755
--- a/PVE/Service/pvestatd.pm
+++ b/PVE/Service/pvestatd.pm
@@ -491,15 +491,16 @@ sub update_sdn_status {
     }
 }
 
-my $broadcast_version_info_done = 0;
+my $version_info;
 my sub broadcast_version_info : prototype() {
-    if (!$broadcast_version_info_done) {
-	PVE::Cluster::broadcast_node_kv(
-	    'version-info',
-	    encode_json(PVE::pvecfg::version_info()),
-	);
-	$broadcast_version_info_done = 1;
+    $version_info //= to_json(PVE::pvecfg::version_info(), { canonical => 1 });
+
+    if (my $old = PVE::Cluster::get_node_kv("version-info")) {
+	$old = $old->{$nodename};
+	return if $old && $old eq $version_info;
     }
+
+    PVE::Cluster::broadcast_node_kv('version-info', $version_info);
 }
 
 sub update_status {
-- 
2.30.2





                 reply	other threads:[~2021-11-12 12:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211112122353.111086-1-w.bumiller@proxmox.com \
    --to=w.bumiller@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal