From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 95ACC1FF0AF for ; Fri, 20 Nov 2026 14:21:37 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B812B21745; Fri, 20 Nov 2026 14:21:35 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 20 Nov 2026 14:21:31 +0100 Message-Id: To: "Thomas Lamprecht" , Subject: Re: [PATCH] lrm: refuse targets dropping the guest identity before stopping guests From: "Daniel Kral" X-Mailer: aerc 0.22.0-45-gc30c872fde7b-dirty References: <20261120025517.3031086-1-t.lamprecht@proxmox.com> In-Reply-To: <20261120025517.3031086-1-t.lamprecht@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795180891926 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.430 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: JP2NWKEEB7NAENUL6WE4N7SX6R736OKL X-Message-ID-Hash: JP2NWKEEB7NAENUL6WE4N7SX6R736OKL X-MailFrom: d.kral@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 Fri Nov 20, 2026 at 3:54 AM CET, Thomas Lamprecht wrote: > The guest migration APIs reject nodes that would drop guest identities, > but HA resource plugins can stop a container or shut down a VM for > relocation before calling those APIs. A refused requested relocation > therefore causes an unnecessary stop and restart. > > For automatic moves, including maintenance, shutdown with the 'migrate' > policy, failback, and affinity rules, the CRM can select the same target > again before restarting the guest. The guest then stays stopped while > relocation is retried. Automatic rebalancing can repeatedly restart a > container instead. > > Have the resource plugins check identity support before the LRM calls > migrate, and treat a refusal as a migration error. A running guest then > stays running on its source node. > > Guest API requests already fail before reaching HA. Direct ha-manager > requests report the refusal in the LRM log. The CRM still retries > automatic moves to unsupported targets, so maintenance or shutdown > with the 'migrate' policy remains blocked until the selected targets > are upgraded, even if other nodes already support identities. > > Signed-off-by: Thomas Lamprecht > --- > > I'm a bit torn here about the specific check employed, but the overal > mechanism is simple enough and could be reused for other migration > blockers in HA. I guess it would be more generic to check whether the `not_allowed_nodes` hash (or `not-allowed-nodes` for pve-container) from the migrate_vm_precondition API does not contain the target node and otherwise fail, to prevent the relocate's stop when we already know that the migrate will fail afterwards... However, if we want to give users a reason to why the migration wasn't done, then the migrate_vm_precondition API does not assert but only gives structured information, which would need to be parsed here again, similar how it's done in the web interface... So also not that ideal. So I think this is fine for now and the patch looks good to me and can be made more generic in the future, so consider as: Reviewed-by: Daniel Kral For a more general approach to acknowledge the migration blockers (that I'm working on), I think it's better for the HA Manager to already know in advance whether an HA resource can be moved and if so where it can go and doesn't issue migrations to nodes where it cannot go at all. This gives the HA Manager some temporal information when the migration blocker exists, because the LRM can only respond whether it didn't work now (return ERROR), but the migration could have been successful just before or right after, so we can only guess from there. And the HA Manager would then also try not to issue migrations at all, that are guaranteed to fail when the LRM will try them some moments later. Even though we cannot derive everything (at least from the config alone, and to minimize too big of an overhead) and there's still the time window where the HA Manager derived the migration blockers and the LRM actually trying out the migration (where the preconditions could have changed in between), it should cover the most obvious cases and reduces the amount of times where the HA Manager (automatically) issues a migration, that then fails for the LRM, which is of course not desirable if we can prevent it.