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 D66808E1D2 for ; Thu, 10 Nov 2022 15:38:49 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 66C4129145 for ; Thu, 10 Nov 2022 15:38:19 +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:14 +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 3E4FD44A9B for ; Thu, 10 Nov 2022 15:38:07 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Thu, 10 Nov 2022 15:37:59 +0100 Message-Id: <20221110143800.98047-21-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 ha-manager 11/11] manager: avoid scoring nodes when not trying next and current node is valid 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:49 -0000 With the Usage::Static plugin, scoring is not as cheap anymore and select_service_node() is called for each running service. This should cover most calls of select_service_node(). Signed-off-by: Fiona Ebner --- I think the whole $found logic can be dropped *if* we ensure that $tried_nodes and $try_next go hand in hand, because all the tried nodes are already not considered as candidates anymore. But this has to be evaluated more carefully and is something for after the release of course :) The test_failover1.pl test doesn't set failed nodes at all and would be the only one to break. src/PVE/HA/Manager.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm index b94ba9d..9d36ea8 100644 --- a/src/PVE/HA/Manager.pm +++ b/src/PVE/HA/Manager.pm @@ -152,6 +152,8 @@ sub select_service_node { return $maintenance_fallback if defined($maintenance_fallback) && $pri_groups->{$top_pri}->{$maintenance_fallback}; + return $current_node if !$try_next && $pri_groups->{$top_pri}->{$current_node}; + my $scores = $online_node_usage->score_nodes_to_start_service($sid, $current_node); my @nodes = sort { $scores->{$a} <=> $scores->{$b} || $a cmp $b @@ -171,8 +173,6 @@ sub select_service_node { } else { return $nodes[0]; } - } elsif (defined($found)) { - return $nodes[$found]; } else { return $nodes[0]; } -- 2.30.2