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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 7D25863674 for ; Tue, 22 Dec 2020 14:39:13 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6D28D2CA23 for ; Tue, 22 Dec 2020 14:39:13 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id B23032CA17 for ; Tue, 22 Dec 2020 14:39:11 +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 76AED44AB1 for ; Tue, 22 Dec 2020 14:39:11 +0100 (CET) Date: Tue, 22 Dec 2020 14:39:09 +0100 From: Wolfgang Bumiller To: Aaron Lauterer Cc: pve-devel@lists.proxmox.com Message-ID: <20201222133909.5b3523yjpdq556di@wobu-vie.proxmox.com> References: <20201222121852.15803-1-a.lauterer@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201222121852.15803-1-a.lauterer@proxmox.com> User-Agent: NeoMutt/20180716 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.051 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [dirplugin.pm, proxmox.com] Subject: Re: [pve-devel] [PATCH storage] fix 3214: DirPlugin: die early if mountpoint not mounted 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: Tue, 22 Dec 2020 13:39:13 -0000 Here our `mkdir` meaning is `create the path to the storage`. I'd propose the following: Apply neither #3214 patch. Keep the `mkdir` code as it is. Deprecate the `mkdir` option and split it up into 2 new options: `create_path` and `populate_directory` It should be harder to confuse those two in the future (plus they can both be set explicitly simultaneously). On Tue, Dec 22, 2020 at 01:18:52PM +0100, Aaron Lauterer wrote: > If the `is_mountpoint` option is enabled, it is sensible to first check > for the mountpoint before proceeding any further in the storage > activation. > > The old behaviour would create the path to the mountpoint if the `mdkir` > option wasn't set to false. This resulted in mountpoints further up > the path to not mount anymore, e.g. nested ZFS datasets. > > Signed-off-by: Aaron Lauterer > --- > > There is another patch[0] already for this bug report but it deals with > a related, but different problem of not creating the internal storage > directory structure if `mkdir 0` was set. > > [0] https://lists.proxmox.com/pipermail/pve-devel/2020-December/046572.html > > PVE/Storage/DirPlugin.pm | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/PVE/Storage/DirPlugin.pm b/PVE/Storage/DirPlugin.pm > index 2267f11..81aaf2b 100644 > --- a/PVE/Storage/DirPlugin.pm > +++ b/PVE/Storage/DirPlugin.pm > @@ -132,17 +132,17 @@ sub status { > sub activate_storage { > my ($class, $storeid, $scfg, $cache) = @_; > > - my $path = $scfg->{path}; > - if (!defined($scfg->{mkdir}) || $scfg->{mkdir}) { > - mkpath $path; > - } Depending on whether we want to also "fix" the defaults (`mkdir` not present meaning it is not *used*, rather than it is `on`), the above should either happen `if !defined($scfg->{create_path})` (not explicitly using `create_path`), or changed to `if ($scfg->{mkdir})` (which should generate a warning). > - > my $mp = parse_is_mountpoint($scfg); > if (defined($mp) && !path_is_mounted($mp, $cache->{mountdata})) { > die "unable to activate storage '$storeid' - " . > "directory is expected to be a mount point but is not mounted: '$mp'\n"; > } > the `is_mountpoint` check would stay here after `mkdir` handling for legacy behavior. and below here is where we'd add the hunk below with `s/mkdir/populate_directory/`; The other patch would do use `populate_directory` if it is explicitly set, otherwise fall through to the old `mkdir` based code with a warning that `populate_directory` should be explicitly set in the config. > + my $path = $scfg->{path}; > + if (!defined($scfg->{mkdir}) || $scfg->{mkdir}) { > + mkpath $path; > + } > + > $class->SUPER::activate_storage($storeid, $scfg, $cache); > } > > -- > 2.20.1