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 474691FF0AA for ; Tue, 17 Nov 2026 14:14:57 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 59558215FE; Tue, 17 Nov 2026 14:14:54 +0100 (CET) Message-ID: <35ea7039-ca22-4266-bc38-302605f6b60d@proxmox.com> Date: Tue, 17 Nov 2026 14:14:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH guest-common 11/34] guest identity: allow taking over a uid that is unused in the cluster To: Thomas Lamprecht , pve-devel@lists.proxmox.com References: <20261116004703.2908294-1-t.lamprecht@proxmox.com> <20261116004703.2908294-12-t.lamprecht@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20261116004703.2908294-12-t.lamprecht@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794921287161 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.291 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: J2BMKNLWIVK47X2B7LDXKWGIIXXIJEHG X-Message-ID-Hash: J2BMKNLWIVK47X2B7LDXKWGIIXXIJEHG X-MailFrom: d.csapak@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: aside from the whole pending/reservation handling being hard to follow, some minor comments inline On 11/16/26 1:53 AM, Thomas Lamprecht wrote: [snip] > + > +# Publishes $uid, for example the one of a restored backup or of the source guest of a remote > +# migration, as the uid of the guest $vmid with the current time as rtime, where that is allowed. > +# > +# $class is the config class of the guest and must have guest identities enabled. $reservation is > +# what create_and_lock_config returned for the operation. The caller must still hold the config > +# lock of $vmid and call this after the final config write of the operation. $uid can be undef if > +# there is nothing to adopt, for example for a backup without uid. > +# > +# A guest that had an identity before the operation keeps it, unless it had $uid as pending uid, > +# see adoptable_uid. Otherwise, $uid only replaces the identity that the reservation published, > +# and only if no other guest in the cluster has it. Whatever the outcome, the pending uid of the > +# config is removed afterwards, as the operation is done. > +# > +# Dies if the cluster-wide identity lock cannot be taken, for example without quorum. The pending > +# uid then stays, as nothing got decided, so that a later operation can still take it over. i find this whole comment a bit hard to read and to follow: one paragraph says 'whatever the outcome, the pending uid [..] is removed [..]', but the next one says: 'dies if [..]. the pending uid then stays' i get that it's about different error scenarios, but the wording is a bit confusing here > +# > +# Returns a hash with the keys 'result', 'uid' (the uid of $vmid afterwards), 'requested' ($uid) > +# and, for the result 'in-use', 'in-use-by' (the lowest VMID of the other guests with $uid). The > +# result is one of: > +# kept - the guest keeps the identity it had before the operation, or already has $uid > +# adopted - $uid got published for $vmid > +# in-use - another guest has $uid, the identity of the reservation stays > +# changed - the identity of the reservation is not published anymore, nothing got changed > +# skipped - $uid is undef, the identity of the reservation stays same here with the wording: kept: keeps identity changed: the identity is not published, nothing got changed so what is the difference? also 'changed' -> 'nothing got changed' seems wrong... > +sub adopt { > + my ($class, $vmid, $uid, $reservation) = @_; > + > + die "guest identities are not enabled for this guest type\n" if !$class->__identity_enabled(); > + die "missing guest identity reservation\n" > + if ref($reservation) ne 'HASH' || !$reservation->{reserved}; > + die "invalid guest identity uid '$uid'\n" if defined($uid) && !is_valid_uid($uid); > + > + my $res = take_over($class, $vmid, $uid, $reservation); > + > + eval { $class->__identity_clear_pending($vmid) }; > + die "unable to remove the pending uid - $@" if $@; > + > + return $res; > +} > +