From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 0B4AB8E133 for ; Thu, 10 Nov 2022 15:38:11 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E8C4828847 for ; Thu, 10 Nov 2022 15:38:10 +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 for ; Thu, 10 Nov 2022 15:38:07 +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 B6EB844B68 for ; Thu, 10 Nov 2022 15:38:05 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Thu, 10 Nov 2022 15:37:45 +0100 Message-Id: <20221110143800.98047-7-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221110143800.98047-1-f.ebner@proxmox.com> References: <20221110143800.98047-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.028 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 1/3] pvestatd: broadcast static node information X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2022 14:38:11 -0000 Planned to be used for static resource scheduling in the HA manager. It's enough to broadcast the values whenever they are outdated or not set in the node's local kv store, because pmxcfs will re-broadcast the local kv store whenever the quorate partition changes. This is already relied upon for the 'ceph-versions' kv pair. Suggested-by: Thomas Lamprecht Signed-off-by: Fiona Ebner --- To avoid potential left-over stale information, the following patch would help: https://lists.proxmox.com/pipermail/pve-devel/2022-October/054219.html PVE/Service/pvestatd.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm index eac953df..eb0dc130 100755 --- a/PVE/Service/pvestatd.pm +++ b/PVE/Service/pvestatd.pm @@ -123,6 +123,24 @@ my $generate_rrd_string = sub { return join(':', map { $_ // 'U' } @$data); }; +my sub broadcast_static_node_info { + my ($cpus, $memory) = @_; + + my $old = PVE::Cluster::get_node_kv('static-info', $nodename); + $old = eval { decode_json($old->{$nodename}) } if defined($old->{$nodename}); + + if ( + !defined($old->{cpus}) || $old->{cpus} != $cpus + || !defined($old->{memory}) || $old->{memory} != $memory + ) { + my $info = { + cpus => $cpus, + memory => $memory, + }; + PVE::Cluster::broadcast_node_kv('static-info', encode_json($info)); + } +} + sub update_node_status { my ($status_cfg) = @_; @@ -175,6 +193,8 @@ sub update_node_status { my $transactions = PVE::ExtMetric::transactions_start($status_cfg); PVE::ExtMetric::update_all($transactions, 'node', $nodename, $node_metric, $ctime); PVE::ExtMetric::transactions_finish($transactions); + + broadcast_static_node_info($maxcpu, $meminfo->{memtotal}); } sub auto_balloning { -- 2.30.2