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 53C5A9A68A for ; Fri, 17 Nov 2023 12:58:15 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 35478322AB for ; Fri, 17 Nov 2023 12:58:15 +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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 17 Nov 2023 12:58:14 +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 3A0FC43DC4 for ; Fri, 17 Nov 2023 12:58:14 +0100 (CET) Date: Fri, 17 Nov 2023 12:58:13 +0100 From: Wolfgang Bumiller To: Fabian =?utf-8?Q?Gr=C3=BCnbichler?= Cc: pve-devel@lists.proxmox.com Message-ID: References: <20231116153128.788593-1-f.gruenbichler@proxmox.com> <20231117070911.69693-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231117070911.69693-1-f.gruenbichler@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.050 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 POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes 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 manager 1/2] api: pools: support nested pools 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: Fri, 17 Nov 2023 11:58:15 -0000 minor issue On Fri, Nov 17, 2023 at 08:09:10AM +0100, Fabian Grünbichler wrote: > since poolid can now contain `/`, it's not possible to use it (properly) as > path parameter anymore. > > accordingly: > - merge `read_pool` (`GET /pools/{poolid}`) into 'index' (`GET > /pools/?poolid={poolid}`) (requires clients to extract the only member of the returned array if they want to query an individual pool) > - move `update_pool` to `/pools`, deprecating the old variant with path parameter > - move `delete_pool` to `/pools`, deprecating the old variant with path parameter > - deprecate `read_pool` API endpoint > > pool creation is blocked for nested pools where the parent does not already > exist. similarly, the checks for deletion are extended to block deletion if > sub-pools still exist. > > the old API endpoints continue to work for non-nested pools. `pvesh ls /pools` > is semi-broken for nested pools, listing the entries, but no methods on them, > since they reference the old API. fixing this would require extending the REST > handling to support a new type of child reference. > > Signed-off-by: Fabian Grünbichler > --- > > Notes: > requires bumped pve-access-control > > PVE/API2/Pool.pm | 243 +++++++++++++++++++++++++++++++++++------------ > 1 file changed, 184 insertions(+), 59 deletions(-) > > diff --git a/PVE/API2/Pool.pm b/PVE/API2/Pool.pm > index 51ac71941..54e744558 100644 > --- a/PVE/API2/Pool.pm > +++ b/PVE/API2/Pool.pm > @@ -354,6 +476,9 @@ __PACKAGE__->register_method ({ > > my $pool_config = $usercfg->{pools}->{$pool}; > die "pool '$pool' does not exist\n" if !$pool_config; > + for my $subpool (sort keys %{$pool_config->{pools}}) { would prefer $pool_config->{pools}->%* > + die "pool '$pool' is not empty (contains pool '$subpool')\n"; a 'for' loop for a single error entry, looks like you meant to do something like this instead: if (length(my $subpools = join(', ', sort keys $pool_config->{pools}->%*))) { die "pool '$pool' is not empty (contains pool '$subpools')\n"; } > + } > > for my $vmid (sort keys %{$pool_config->{vms}}) { > next if !$idlist->{$vmid}; # ignore destroyed guests > -- > 2.39.2