From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 6CFC91FF16B for ; Tue, 29 Jul 2025 20:01:37 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 711B21A251; Tue, 29 Jul 2025 20:01:49 +0200 (CEST) From: Daniel Kral To: pve-devel@lists.proxmox.com Date: Tue, 29 Jul 2025 20:00:47 +0200 Message-ID: <20250729180107.428855-8-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250729180107.428855-1-d.kral@proxmox.com> References: <20250729180107.428855-1-d.kral@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753812063378 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.014 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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 ha-manager v4 07/19] manager: read and update rules config 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Read the rules configuration in each round and update the canonicalized rules configuration if there were any changes since the last round to reduce the amount of times of verifying the rule set. Signed-off-by: Daniel Kral --- src/PVE/HA/Manager.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm index c57a280c..88ff4a65 100644 --- a/src/PVE/HA/Manager.pm +++ b/src/PVE/HA/Manager.pm @@ -8,6 +8,8 @@ use Digest::MD5 qw(md5_base64); use PVE::Tools; use PVE::HA::Tools ':exit_codes'; use PVE::HA::NodeStatus; +use PVE::HA::Rules; +use PVE::HA::Rules::NodeAffinity; use PVE::HA::Usage::Basic; use PVE::HA::Usage::Static; @@ -41,7 +43,11 @@ sub new { my $class = ref($this) || $this; - my $self = bless { haenv => $haenv, crs => {} }, $class; + my $self = bless { + haenv => $haenv, + crs => {}, + last_rules_digest => '', + }, $class; my $old_ms = $haenv->read_manager_status(); @@ -556,6 +562,18 @@ sub manage { delete $ss->{$sid}; } + my $new_rules = $haenv->read_rules_config(); + + if ($new_rules->{digest} ne $self->{last_rules_digest}) { + + my $messages = PVE::HA::Rules->canonicalize($new_rules); + $haenv->log('info', $_) for @$messages; + + $self->{rules} = $new_rules; + + $self->{last_rules_digest} = $self->{rules}->{digest}; + } + $self->update_crm_commands(); for (;;) { -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel