public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Kral <d.kral@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC ha-manager 2/3] manager: fix ~revision version check for ha groups migration
Date: Thu, 31 Jul 2025 16:27:18 +0200	[thread overview]
Message-ID: <20250731142749.192813-3-d.kral@proxmox.com> (raw)
In-Reply-To: <20250731142749.192813-1-d.kral@proxmox.com>

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@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-07-31 14:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 14:27 [pve-devel] [RFC ha-manager 0/3] HA rules follow up (part 1) Daniel Kral
2025-07-31 14:27 ` [pve-devel] [RFC ha-manager 1/3] manager: support older versioning schema for ha group migration Daniel Kral
2025-07-31 14:27 ` Daniel Kral [this message]
2025-07-31 14:27 ` [pve-devel] [RFC ha-manager 3/3] test: ha tester: add ha groups migration tests with runtime upgrades Daniel Kral
2025-08-01 16:25 ` [pve-devel] superseded: [RFC ha-manager 0/3] HA rules follow up (part 1) Daniel Kral

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250731142749.192813-3-d.kral@proxmox.com \
    --to=d.kral@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal