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