[pve-devel] [RFC ha-manager 2/3] manager: fix ~revision version check for ha groups migration

Daniel Kral d.kral at proxmox.com
Thu Jul 31 16:27:18 CEST 2025


For the minimum version of 9.0.0~16 to migrate ha groups, the version
9.0.0 would fail the test as 0 < 16 would be true. If the ~revision is
not set for $version, then it is ordered after any minimum ~revision.

Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
I haven't extensively tested this yet, but stumbled upon it while
writing the test cases in the next patch. I'll try to squeeze in moving
that helper to PVE::HA::Tools and having some actual unit tests for
that to be sure.

 src/PVE/HA/Manager.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index 9d7cb73f..0be12061 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -548,10 +548,13 @@ my $has_node_min_version = sub {
     return 0 if $major == $min_major && $minor < $min_minor;
     return 0 if $major == $min_major && $minor == $min_minor && $patch < $min_patch;
 
-    $rev //= 0;
     $min_rev //= 0;
     return 0
-        if $major == $min_major && $minor == $min_minor && $patch == $min_patch && $rev < $min_rev;
+        if $major == $min_major
+        && $minor == $min_minor
+        && $patch == $min_patch
+        && defined($rev)
+        && $rev < $min_rev;
 
     return 1;
 };
-- 
2.47.2





More information about the pve-devel mailing list