]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
manager: update crs scheduling mode once per round
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 19 Nov 2022 12:36:57 +0000 (13:36 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 19 Nov 2022 13:05:26 +0000 (14:05 +0100)
Pretty safe to do as we recompute everything per round anyway (and
much more often on top of that, but that's another topic).

Actually I'd argue that it's safer as this way a user doesn't need to
actively restart the manager, which grinds much more gears and
watchdog changes than checking periodically and updating it
internally. Plus, a lot of admins won't expect that they need to
restart the current active master and thus they'll complain that
their recently made change to the CRS config had no effect/the CRS
doesn't work at all.

We should codify such a change in test for this though.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/HA/Manager.pm

index eedf984c6804a6f58d80f340155e8409942bec8f..eb0fda9471582392d9ddd08026e377179e9d1e6b 100644 (file)
@@ -53,7 +53,7 @@ sub new {
 
     $self->{ms} = { master_node => $haenv->nodename() };
 
-    $self->update_crs_scheduler_mode(); # initial se
+    $self->update_crs_scheduler_mode(); # initial set, we update it once every loop
 
     return $self;
 }
@@ -69,6 +69,10 @@ sub update_crs_scheduler_mode {
 
     if (!defined($old_mode)) {
        $haenv->log('info', "using scheduler mode '$new_mode'") if $new_mode ne 'basic';
+    } elsif ($new_mode eq $old_mode) {
+       return; # nothing to do
+    } else {
+       $haenv->log('info', "switching scheduler mode from '$old_mode' to '$new_mode'");
     }
 
     $self->{'scheduler-mode'} = $new_mode;
@@ -430,6 +434,8 @@ sub manage {
        return;
     }
 
+    $self->update_crs_scheduler_mode();
+
     my $sc = $haenv->read_service_config();
 
     $self->{groups} = $haenv->read_group_config(); # update