all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Kral <d.kral@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH ha-manager v2 6/7] manager: remove failed nodes earlier in select_service_node
Date: Fri,  6 Nov 2026 10:56:49 +0100	[thread overview]
Message-ID: <20261106095650.72865-7-d.kral@proxmox.com> (raw)
In-Reply-To: <20261106095650.72865-1-d.kral@proxmox.com>

This is done in preparation of an upcoming patch, which moves the
maintenance node fallback behavior logic up as well, so move up the
failed nodes earlier here as well to maintain it.

This does not change the behavior of select_service_node(), because the
now subsequent random migrations check is only done if the
$node_preference = 'none', while the failed nodes are only removed in
$node_preference = 'try-next'.

Suggested-by: Michael Köppl <m.koeppl@proxmox.com>
Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
changes since v1:
- new!

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

diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index 3c768a86..b2b74282 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -367,6 +367,13 @@ sub select_service_node {
 
     my ($allowed_nodes, $pri_nodes) = get_node_affinity($node_affinity, $sid, $online_nodes);
 
+    # try to avoid nodes where the HA resource failed already if we want to relocate
+    if ($node_preference eq 'try-next') {
+        for my $node (@$tried_nodes) {
+            delete $pri_nodes->{$node};
+        }
+    }
+
     return undef if !%$pri_nodes;
 
     # stay on current node if possible (avoids random migrations)
@@ -381,13 +388,6 @@ sub select_service_node {
         return $current_node;
     }
 
-    # try to avoid nodes where the service failed already if we want to relocate
-    if ($node_preference eq 'try-next') {
-        foreach my $node (@$tried_nodes) {
-            delete $pri_nodes->{$node};
-        }
-    }
-
     return $maintenance_fallback
         if defined($maintenance_fallback) && $pri_nodes->{$maintenance_fallback};
 
-- 
2.47.3





  parent reply	other threads:[~2026-11-06  9:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  9:56 [PATCH-SERIES ha-manager v2 0/7] improve handling of maintenance nodes Daniel Kral
2026-11-06  9:56 ` [PATCH ha-manager v2 1/7] manager: warn if HA resources cannot be moved away from maintenance node Daniel Kral
2026-11-06  9:56 ` [PATCH ha-manager v2 2/7] test: add test cases for node affinity rules with maintenance mode Daniel Kral
2026-11-06  9:56 ` [PATCH ha-manager v2 3/7] test: add test cases for resource " Daniel Kral
2026-11-06  9:56 ` [PATCH ha-manager v2 4/7] manager: apply negative resource affinity before get_node_affinity Daniel Kral
2026-11-06  9:56 ` [PATCH ha-manager v2 5/7] manager: make HA resource bundles move back to maintenance node Daniel Kral
2026-11-06  9:56 ` Daniel Kral [this message]
2026-11-06  9:56 ` [PATCH ha-manager v2 7/7] manager: move HA resources without failback " 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=20261106095650.72865-7-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal