all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] pvestatd: rebroadcast version info as needed
@ 2021-11-12 12:23 Wolfgang Bumiller
  0 siblings, 0 replies; only message in thread
From: Wolfgang Bumiller @ 2021-11-12 12:23 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-12 12:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 12:23 [pve-devel] [PATCH manager] pvestatd: rebroadcast version info as needed Wolfgang Bumiller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal