[pve-devel] [PATCH v2 ha-manager 04/15] manager: select service node: add $sid to parameters

Fiona Ebner f.ebner at proxmox.com
Thu Nov 17 15:00:05 CET 2022


In preparation for scheduling based on static information, where the
scoring of nodes depends on information from the service's
VM/CT configuration file (and the $sid is required to query that).

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---

No changes from v1.

 src/PVE/HA/Manager.pm      | 4 +++-
 src/test/test_failover1.pl | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index 518f64f..63c94af 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -119,7 +119,7 @@ sub get_node_priority_groups {
 }
 
 sub select_service_node {
-    my ($groups, $online_node_usage, $service_conf, $current_node, $try_next, $tried_nodes, $maintenance_fallback) = @_;
+    my ($groups, $online_node_usage, $sid, $service_conf, $current_node, $try_next, $tried_nodes, $maintenance_fallback) = @_;
 
     my $group = get_service_group($groups, $online_node_usage, $service_conf);
 
@@ -766,6 +766,7 @@ sub next_state_started {
 	    my $node = select_service_node(
 	        $self->{groups},
 		$self->{online_node_usage},
+		$sid,
 		$cd,
 		$sd->{node},
 		$try_next,
@@ -847,6 +848,7 @@ sub next_state_recovery {
     my $recovery_node = select_service_node(
 	$self->{groups},
 	$self->{online_node_usage},
+	$sid,
 	$cd,
 	$sd->{node},
     );
diff --git a/src/test/test_failover1.pl b/src/test/test_failover1.pl
index 67573a2..f11d1a6 100755
--- a/src/test/test_failover1.pl
+++ b/src/test/test_failover1.pl
@@ -30,7 +30,7 @@ sub test {
     my ($expected_node, $try_next) = @_;
     
     my $node = PVE::HA::Manager::select_service_node
-	($groups, $online_node_usage, $service_conf, $current_node, $try_next);
+	($groups, $online_node_usage, "vm:111", $service_conf, $current_node, $try_next);
 
     my (undef, undef, $line) = caller();
     die "unexpected result: $node != ${expected_node} at line $line\n" 
-- 
2.30.2






More information about the pve-devel mailing list