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 945D1BA6D3 for ; Wed, 20 Mar 2024 10:25:38 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7952CCA9F for ; Wed, 20 Mar 2024 10:25:38 +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 10:25:37 +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 A774245BD0 for ; Wed, 20 Mar 2024 10:25:37 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 20 Mar 2024 10:25:36 +0100 Message-Id: From: "Max Carrara" To: =?utf-8?q?Fabian_Gr=C3=BCnbichler?= , "Proxmox VE development discussion" X-Mailer: aerc 0.17.0-72-g6a84f1331f1c References: <20240305150758.252669-1-m.carrara@proxmox.com> <20240305150758.252669-16-m.carrara@proxmox.com> <1710841288.jsqryni90l.astroid@yuna.none> <646822040.13388.1710921952117@webmail.proxmox.com> In-Reply-To: <646822040.13388.1710921952117@webmail.proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.026 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 09:25:38 -0000 On Wed Mar 20, 2024 at 9:05 AM CET, Fabian Gr=C3=BCnbichler wrote: > > Max Carrara hat am 19.03.2024 18:41 CET geschri= eben: > > 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 fa= n > > 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 :) ACK! > > > > > + > > > > + > > [..] > > > > > + > > > > +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 any= thing else here it seems, and the fact that librados uses it because it for= ks itself and wants to clean up in case it is called in an API server proce= ss is not obvious ;) > > you could replace those lines with a call to setup_default_cli_env that d= oes all of the above and the "am I root" check in one ;) Also ACK! Thanks again for your input!