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 DFFB91FF13F for ; Thu, 12 Mar 2026 04:35:50 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 70FC05DE; Thu, 12 Mar 2026 04:35:44 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 12 Mar 2026 11:35:02 +0800 Message-Id: Subject: Re: [PATCH manager 1/1] ceph: osd: fix bootstrap keyring creation when auth_client_required is not in ceph.conf From: "Kefu Chai" To: "Thomas Lamprecht" , X-Mailer: aerc 0.20.0 References: <40e8e151-a812-4041-a4de-b0a79098eb73@proxmox.com> In-Reply-To: <40e8e151-a812-4041-a4de-b0a79098eb73@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773286473686 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.750 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 RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.408 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.819 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.903 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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: TKPQZLBUT5VXVF4Y34E5YJJO2LELCNQD X-Message-ID-Hash: TKPQZLBUT5VXVF4Y34E5YJJO2LELCNQD X-MailFrom: k.chai@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 CC: Kefu Chai 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 Thu Mar 12, 2026 at 1:01 AM CST, Thomas Lamprecht wrote: > Am 11.03.26 um 14:29 schrieb Kefu Chai: >> The condition guarding bootstrap-osd keyring creation checks for >> `auth_client_required eq 'cephx'` by reading ceph.conf directly. When >> this setting is absent from ceph.conf (relying on the Ceph default, or >> configured via the mon config database instead), the check evaluates as >> `undef eq 'cephx'` which is false, causing PVE to skip creating the >> bootstrap keyring. ceph-volume then fails because it cannot find >> /var/lib/ceph/bootstrap-osd/ceph.keyring. >>=20 >> This can happen when: >> - ceph.conf [global] was created before `pveceph init` wrote the auth >> settings (pveceph init skips writing them if [global] already exists) >> - auth settings were moved from ceph.conf to the mon config database >> - an upgrade or migration left ceph.conf without the auth lines >>=20 >> Fix by defaulting to 'cephx' when the setting is absent (matching >> Ceph's own default) and inverting the check to only skip keyring >> creation when auth is explicitly set to 'none'. >>=20 >> Signed-off-by: Kefu Chai >> Signed-off-by: Kefu Chai >> --- >> PVE/API2/Ceph/OSD.pm | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >>=20 >> diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm >> index a952c952..062729ae 100644 >> --- a/PVE/API2/Ceph/OSD.pm >> +++ b/PVE/API2/Ceph/OSD.pm >> @@ -407,7 +407,7 @@ __PACKAGE__->register_method({ >> =20 >> if ( >> !-f $ceph_bootstrap_osd_keyring >> - && $ceph_conf->{global}->{auth_client_required} eq 'cephx' >> + && ($ceph_conf->{global}->{auth_client_required} // 'cephx'= ) ne 'none' > > As the same variable is already accessed in the line above without a > fallback, it either has to be already always defined and this // 'cephx' > is superfluous, or we should pull that out upfront and use it for both, > like: > > my $auth_client_required =3D $ceph_conf->{global}->{auth_client_required}= // 'cephx'; > > (disclaimer, I did not review within the full code context, only found > above pattern slightly odd) Thank you for the feedback! Your suggestion to extract $auth_client_required to a named variable is a good style improvement: it makes the intent clearer and is more readable. I've updated the patch to do exactly that. Regarding "accessed in the line above without a fallback": in this function, auth_client_required is only read in one place (the if condition), so there isn't a second use to consolidate. The diff context does show other $ceph_conf->{global}->{...} accesses nearby, which may be what caught your eye. Totally understandable given you noted you didn't have the full context. The updated version now reads: my $auth_client_required =3D $ceph_conf->{global}->{auth_client_required} /= / 'cephx'; if (!-f $ceph_bootstrap_osd_keyring && $auth_client_required ne 'none') { This is cleaner regardless, since the extracted variable avoids the long hash dereference inside the condition. Thanks again for taking a look! > >> ) { >> my $bindata =3D $rados->mon_command({ >> prefix =3D> 'auth get-or-create',