[pve-devel] [PATCH ha-manager 3/5] scheduling: make static scheduling optional

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Sep 22 14:04:32 CEST 2025


it's not available in the simulator

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 src/PVE/HA/Manager.pm | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index ba59f64..cfd509a 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -14,7 +14,12 @@ use PVE::HA::Rules::NodeAffinity qw(get_node_affinity);
 use PVE::HA::Rules::ResourceAffinity
     qw(get_affinitive_resources get_resource_affinity apply_positive_resource_affinity apply_negative_resource_affinity);
 use PVE::HA::Usage::Basic;
-use PVE::HA::Usage::Static;
+
+my $have_static_scheduling;
+eval {
+    require PVE::HA::Usage::Static;
+    $have_static_scheduling = 1;
+};
 
 ## Variable Name & Abbreviations Convention
 #
@@ -244,11 +249,15 @@ sub recompute_online_node_usage {
 
     if (my $mode = $self->{crs}->{scheduler}) {
         if ($mode eq 'static') {
-            $online_node_usage = eval {
-                my $scheduler = PVE::HA::Usage::Static->new($haenv);
-                $scheduler->add_node($_) for $online_nodes->@*;
-                return $scheduler;
-            };
+            if ($have_static_scheduling) {
+                $online_node_usage = eval {
+                    my $scheduler = PVE::HA::Usage::Static->new($haenv);
+                    $scheduler->add_node($_) for $online_nodes->@*;
+                    return $scheduler;
+                };
+            } else {
+                $@ = "static scheduling not available\n";
+            }
             $haenv->log(
                 'warning',
                 "fallback to 'basic' scheduler mode, init for 'static' failed - $@",
-- 
2.47.3





More information about the pve-devel mailing list