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 E1CE89380 for ; Thu, 17 Nov 2022 15:00:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4F4CF2D669 for ; Thu, 17 Nov 2022 15:00:28 +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, 17 Nov 2022 15:00:25 +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 E9EE444D7F for ; Thu, 17 Nov 2022 15:00:23 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Thu, 17 Nov 2022 15:00:12 +0100 Message-Id: <20221117140018.105004-12-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221117140018.105004-1-f.ebner@proxmox.com> References: <20221117140018.105004-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: =?UTF-8?Q?0=0A=09?=AWL 0.027 Adjusted score from AWL reputation of From: =?UTF-8?Q?address=0A=09?=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 =?UTF-8?Q?Alignment=0A=09?=SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF =?UTF-8?Q?Record=0A=09?=SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH v2 ha-manager 11/15] manager: avoid scoring nodes if maintenance fallback 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, 17 Nov 2022 14:00:53 -0000 With the Usage::Static plugin, scoring is not as cheap anymore and select_service_node() is called for each running service. Signed-off-by: Fiona Ebner --- No changes from v1. src/PVE/HA/Manager.pm | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm index 7f1d1d7..cc2ada4 100644 --- a/src/PVE/HA/Manager.pm +++ b/src/PVE/HA/Manager.pm @@ -149,25 +149,20 @@ sub select_service_node { } } + return $maintenance_fallback + if defined($maintenance_fallback) && $pri_groups->{$top_pri}->{$maintenance_fallback}; + my $scores = $online_node_usage->score_nodes_to_start_service($sid, $current_node); my @nodes = sort { $scores->{$a} <=> $scores->{$b} || $a cmp $b } keys %{$pri_groups->{$top_pri}}; my $found; - my $found_maintenance_fallback; for (my $i = scalar(@nodes) - 1; $i >= 0; $i--) { my $node = $nodes[$i]; if ($node eq $current_node) { $found = $i; } - if (defined($maintenance_fallback) && $node eq $maintenance_fallback) { - $found_maintenance_fallback = $i; - } - } - - if (defined($found_maintenance_fallback)) { - return $nodes[$found_maintenance_fallback]; } if ($try_next) { -- 2.30.2