From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5FB5FBA63E for ; Wed, 20 Mar 2024 09:06:27 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 409FFB175 for ; Wed, 20 Mar 2024 09:05:57 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 20 Mar 2024 09:05:53 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D3431463C1 for ; Wed, 20 Mar 2024 09:05:52 +0100 (CET) Date: Wed, 20 Mar 2024 09:05:52 +0100 (CET) From: =?UTF-8?Q?Fabian_Gr=C3=BCnbichler?= To: Proxmox VE development discussion , Max Carrara Message-ID: <646822040.13388.1710921952117@webmail.proxmox.com> In-Reply-To: References: <20240305150758.252669-1-m.carrara@proxmox.com> <20240305150758.252669-16-m.carrara@proxmox.com> <1710841288.jsqryni90l.astroid@yuna.none> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.6-Rev59 X-Originating-Client: open-xchange-appsuite X-SPAM-LEVEL: Spam detection results: 0 AWL 0.064 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH v4 pve-manager 15/16] fix #4759: ceph: configure ceph-crash.service and its key X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2024 08:06:27 -0000 > Max Carrara hat am 19.03.2024 18:41 CET geschrieb= en: > On Tue Mar 19, 2024 at 11:04 AM CET, Fabian Gr=C3=BCnbichler wrote: > > On March 5, 2024 4:07 pm, Max Carrara wrote: > > > diff --git a/bin/pve-init-ceph-crash b/bin/pve-init-ceph-crash > > > new file mode 100755 > > > index 00000000..c8e9217d > > > --- /dev/null > > > +++ b/bin/pve-init-ceph-crash > > > @@ -0,0 +1,129 @@ > > > +#!/usr/bin/perl > > > + > > > +use strict; > > > +use warnings; > > > + > > > +use List::Util qw(first); > > > + > > > +use PVE::Ceph::Tools; > > > +use PVE::Cluster; > > > +use PVE::RADOS; > > > +use PVE::RPCEnvironment; > > > + > > > +my $ceph_cfg_file =3D 'ceph.conf'; > > > +my $keyring_value =3D '/etc/pve/ceph/$cluster.$name.keyring'; > > > + > > > +my $entity =3D 'client.crash'; > > > > nit: this could be inlined? >=20 > Inlined as in use 'client.crash' as the key directly? Eh, I'm more a fan > of using a variable here, as constantly spelling it out while changing a > bunch of things gets a little painful ... >=20 > If you meant that I should put it in `try_adapt_cfg` - sure, I missed > that that's the only `sub` in which it's being used, woops! both would be fine for me :) > > > + > > > + [..] > > > + > > > +sub main { > > > + my $rpcenv =3D PVE::RPCEnvironment->init('cli'); > > > + > > > + $rpcenv->init_request(); > > > + $rpcenv->set_language($ENV{LANG}); > > > + $rpcenv->set_user('root@pam'); > > > > why do we need an rpcenv here? >=20 > Double-checked, just to be sure: `librados-perl` requires an > `RPCEnvironment` to do some handling regarding forks - > `RPCEnvironment::get()` will die if no env was initialized. good to know. maybe a comment makes sense - the rpcenv is not used by anyth= ing else here it seems, and the fact that librados uses it because it forks= itself and wants to clean up in case it is called in an API server process= is not obvious ;) you could replace those lines with a call to setup_default_cli_env that doe= s all of the above and the "am I root" check in one ;)