[pve-devel] [PATCH ha-manager v3 01/13] rules: introduce plugin-specific canonicalize routines
Daniel Kral
d.kral at proxmox.com
Fri Jul 4 20:20:44 CEST 2025
These are needed by the resource affinity rule type in an upcoming
patch, which needs to make changes to the existing rule set to properly
synthesize inferred rules after the rule set is already made feasible.
Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
src/PVE/HA/Rules.pm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/PVE/HA/Rules.pm b/src/PVE/HA/Rules.pm
index bda0b5d..39c349d 100644
--- a/src/PVE/HA/Rules.pm
+++ b/src/PVE/HA/Rules.pm
@@ -354,6 +354,18 @@ sub check_feasibility : prototype($$) {
return $global_errors;
}
+=head3 $class->plugin_canonicalize($rules)
+
+B<OPTIONAL:> Can be implemented in the I<rule plugin>.
+
+Modifies the C<$rules> to a plugin-specific canonical form.
+
+=cut
+
+sub plugin_canonicalize : prototype($$) {
+ my ($class, $rules) = @_;
+}
+
=head3 $class->canonicalize($rules)
Modifies C<$rules> to contain only feasible rules.
@@ -385,6 +397,12 @@ sub canonicalize : prototype($$) {
}
}
+ for my $type (@$types) {
+ my $plugin = $class->lookup($type);
+ eval { $plugin->plugin_canonicalize($rules) };
+ next if $@; # plugin doesn't implement plugin_canonicalize(...)
+ }
+
return $messages;
}
--
2.39.5
More information about the pve-devel
mailing list