[pve-devel] [PATCH ha-manager 10/11] manager: avoid scoring nodes if maintenance fallback node is valid
Fiona Ebner
f.ebner at proxmox.com
Thu Nov 10 15:37:58 CET 2022
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 <f.ebner at proxmox.com>
---
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 7c85b67..b94ba9d 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
More information about the pve-devel
mailing list