From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id CFC031FF13A for ; Wed, 29 Apr 2026 18:58:30 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7C67E13D54; Wed, 29 Apr 2026 18:58:29 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 29 Apr 2026 18:58:25 +0200 Message-Id: From: =?utf-8?q?Michael_K=C3=B6ppl?= To: "Daniel Kral" , Subject: Re: [PATCH ha-manager 7/7] manager: try multiple priority classes when applying negative resource affinity X-Mailer: aerc 0.21.0 References: <20260422100035.232716-1-d.kral@proxmox.com> <20260422100035.232716-8-d.kral@proxmox.com> In-Reply-To: <20260422100035.232716-8-d.kral@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1777481807795 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.094 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: PWN2BIDTVK4A6QQHDC4YBQD3AG57KEM2 X-Message-ID-Hash: PWN2BIDTVK4A6QQHDC4YBQD3AG57KEM2 X-MailFrom: m.koeppl@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed Apr 22, 2026 at 12:00 PM CEST, Daniel Kral wrote: [snip] > @@ -354,7 +363,15 @@ sub select_service_node { > } > } > =20 > - apply_negative_resource_affinity($separate, $pri_nodes); > + # do not consider nodes where HA resources from a possible negative = resource > + # affinity rule are running on. > + # as such a negative resource affinity could end up emptying the cur= rent > + # priority class, try the succeeding priority classes which result i= n a > + # non-empty node set or else end up with an empty set. > + do { > + apply_negative_resource_affinity($separate, $pri_nodes); > + } while (keys %$pri_nodes < 1 && ($pri_nodes =3D shift @$priority_cl= asses)); > + $pri_nodes =3D {} if !defined($pri_nodes); Just above this, $tried_nodes is removed from $pri_nodes. If the $tried_nodes are not also removed from other priority classes, couldn't this run into a migration loop where it tries again and again to migrate to a failed node from a lower priority class? I'm not entirely sure about this, it just seemed a bit odd to me at first glance. The only scenario I can think of is one where you have vm:100, vm:101 with a non-strict node affinity rule for vm:100 (so you'd have 2 priority classes. don't think it's possible otherwise because you cannot combine negative resource affinity rule and node affinity rule with priorities.) and a negative resource affinity rule that keeps vm:100 and vm:101 apart and then migrating vm:100 to the other available node (one not in the node affinity rule, so with prio -1 and therefore lower prio class) fails. > =20 > # fallback to the previous maintenance node if it is available again= . > # > diff --git a/src/test/test-resource-affinity-with-node-affinity-maintenan= ce-strict-negative1/README b/src/test/test-resource-affinity-with-node-affi= nity-maintenance-strict-negative1/README > index c6a11cec..e1fc0d04 100644 > --- a/src/test/test-resource-affinity-with-node-affinity-maintenance-stri= ct-negative1/README > +++ b/src/test/test-resource-affinity-with-node-affinity-maintenance-stri= ct-negative1/README > @@ -4,5 +4,6 @@ > - in a non-strict node affinity rule to node2 and node3 (equal priority)= , and > - in a strict negative resource affinity rule with each other. [snip]