]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
manager: avoid scoring nodes when not trying next and current node is valid
authorFiona Ebner <f.ebner@proxmox.com>
Thu, 17 Nov 2022 14:00:13 +0000 (15:00 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Nov 2022 12:25:21 +0000 (13:25 +0100)
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 <f.ebner@proxmox.com>
src/PVE/HA/Manager.pm

index cc2ada404c08af7186bd52de042ba0020d76d82a..69bfbc3cb2e19c95048c8b30385bb8018520fd58 100644 (file)
@@ -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];
     }