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 AEC851FF173 for ; Mon, 25 Nov 2024 14:45:17 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 231CF14217; Mon, 25 Nov 2024 14:45:17 +0100 (CET) Date: Mon, 25 Nov 2024 14:44:40 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20241122144713.299130-1-h.laimer@proxmox.com> <20241122144713.299130-8-h.laimer@proxmox.com> In-Reply-To: <20241122144713.299130-8-h.laimer@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1732542160.of8bqk38he.astroid@yuna.none> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.049 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 Subject: Re: [pbs-devel] [PATCH proxmox-backup v14 07/25] api: add check for nested datastores on creation X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" On November 22, 2024 3:46 pm, Hannes Laimer wrote: > Signed-off-by: Hannes Laimer > --- > * new in v14, and not removable datastore specific > > src/api2/config/datastore.rs | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs > index 420f8ddd0..75e1a1a56 100644 > --- a/src/api2/config/datastore.rs > +++ b/src/api2/config/datastore.rs > @@ -81,6 +81,20 @@ pub(crate) fn do_create_datastore( > bail!("cannot create datastore in root path"); > } > > + for store in config.convert_to_typed_array::("datastore")? { > + if store.backing_device != datastore.backing_device { > + continue; > + } this is not needed, if you compare absolute_paths below? > + if store.path.starts_with(&datastore.path) || datastore.path.starts_with(&store.path) { this is broken, as `path` is a String here, and not a Path, so `starts_with` doesn't properly match on path components, but on arbitrary substrings.. i.e., I can't configure two removable datastores, one using "removable" and one using "removable2" as path atm.. > + param_bail!( > + "path", > + "nested datastores not allowed: '{}' already in '{}'", > + store.name, > + store.path > + ); > + } > + } > + > let need_unmount = datastore.backing_device.is_some(); > if need_unmount { > do_mount_device(datastore.clone())?; > -- > 2.39.5 > > > > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel > > > _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel