From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 1D8D61FF0AA for ; Tue, 17 Nov 2026 13:47:30 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B23AE21614; Tue, 17 Nov 2026 13:47:26 +0100 (CET) Message-ID: <1cb413e3-0956-4f56-944e-1731563dc711@proxmox.com> Date: Tue, 17 Nov 2026 13:47:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH guest-common 09/34] abstract config: assign a guest identity and keep it on config writes From: Dominik Csapak To: Thomas Lamprecht , pve-devel@lists.proxmox.com References: <20261116004703.2908294-1-t.lamprecht@proxmox.com> <20261116004703.2908294-10-t.lamprecht@proxmox.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794919643497 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: AMLXOIKRHLWJ7VAF4B2W5LDE4S73IBUT X-Message-ID-Hash: AMLXOIKRHLWJ7VAF4B2W5LDE4S73IBUT 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: On 11/17/26 11:48 AM, Dominik Csapak wrote: [snip] >> +    } >> + >> +    return { identity => PVE::GuestIdentity::parse_identity($meta) }; >> +} >> + >>   # Generate and write config file for this VM/CT >> +# >> +# With guest identities enabled for the class, the identity published >> in the existing config file >> +# gets set in $conf, whatever $conf contains, or a new one if none is >> published. So a config write >> +# never changes a published identity. >>   sub write_config { >>       my ($class, $vmid, $conf) = @_; >>       my $cfspath = $class->cfs_config_path($vmid); >> -    PVE::Cluster::cfs_write_file($cfspath, $conf); >> +    if (!$class->__identity_enabled()) { >> +        PVE::Cluster::cfs_write_file($cfspath, $conf); >> +        return; >> +    } >> + >> +    $class->__identity_lock( >> +        $vmid, >> +        sub { >> +            my $published = $class->__identity_read_published($vmid); >> +            my $identity = $published && $published->{identity}; >> + >> +            # a published uid without valid rtime can only come from >> a manual edit >> +            if (!$identity || !defined($identity->{rtime})) { > > the check for rtime here can't ever work since $identity is a boolean? > i think it's mean to be `!defined($published->{rtime})` , no ? > >> +                $identity = >> PVE::GuestIdentity::new_identity($identity && $identity->{uid});\ > > same here, the $identity->{uid} access can't work... what i wrote here is actually wrong: my $foo = 1 && { bar => 2 }; will assign { bar => 2 } into $foo (perl is weird...) so this works. It's a very unconvential way to write it IMO maybe my $foo; $foo = $hash if $condition; would be better? (even though it's a line longer?) not a big issue, but a reader in the future could be as confused as i was ^^