From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH manager 1/2] api: pools: support nested pools
Date: Fri, 17 Nov 2023 12:58:13 +0100 [thread overview]
Message-ID: <n3nomap6ufax4vvmbvbxoeylsiw7fng7yfercfboxvq53ijpwd@s3mfk4tdk664> (raw)
In-Reply-To: <20231117070911.69693-1-f.gruenbichler@proxmox.com>
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 <f.gruenbichler@proxmox.com>
> ---
>
> 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
next prev parent reply other threads:[~2023-11-17 11:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 15:31 [pve-devel] [RFC access-control/manager 0/4] fix #1148: " Fabian Grünbichler
2023-11-16 15:31 ` [pve-devel] [PATCH access-control 1/2] allow up to three levels of pool nesting Fabian Grünbichler
2023-11-17 10:00 ` Wolfgang Bumiller
2023-11-17 15:31 ` Fabian Grünbichler
2023-11-16 15:31 ` [pve-devel] [PATCH access-control 2/2] pools: record parent/subpool information Fabian Grünbichler
2023-11-17 10:10 ` Wolfgang Bumiller
2023-11-17 15:29 ` Fabian Grünbichler
2023-11-16 15:33 ` Fabian Grünbichler
2023-11-16 15:54 ` [pve-devel] [RFC access-control/manager 0/4] fix #1148: nested pools Philipp Hufnagl
2023-11-17 7:09 ` [pve-devel] [PATCH manager 1/2] api: pools: support " Fabian Grünbichler
2023-11-17 7:09 ` [pve-devel] [PATCH manager 2/2] ui: pools: switch to new API endpoints Fabian Grünbichler
2023-11-17 11:58 ` Wolfgang Bumiller [this message]
2023-11-17 15:27 ` [pve-devel] [PATCH manager 1/2] api: pools: support nested pools Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=n3nomap6ufax4vvmbvbxoeylsiw7fng7yfercfboxvq53ijpwd@s3mfk4tdk664 \
--to=w.bumiller@proxmox.com \
--cc=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.