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 ED3101FF164 for ; Fri, 22 Nov 2024 15:47:14 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 041D415689; Fri, 22 Nov 2024 15:47:24 +0100 (CET) From: Hannes Laimer To: pbs-devel@lists.proxmox.com Date: Fri, 22 Nov 2024 15:46:54 +0100 Message-Id: <20241122144713.299130-8-h.laimer@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241122144713.299130-1-h.laimer@proxmox.com> References: <20241122144713.299130-1-h.laimer@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.024 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: [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" 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; + } + if store.path.starts_with(&datastore.path) || datastore.path.starts_with(&store.path) { + 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