public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Jakob Klocker <j.klocker@proxmox.com>
To: "Max R. Carrara" <m.carrara@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH pve-storage v2 03/17] api: plugins/storage: add initial routes and endpoints
Date: Mon, 20 Jul 2026 14:17:49 +0200	[thread overview]
Message-ID: <2dbd5b88-f1b3-485e-a898-1268dcac26f4@proxmox.com> (raw)
In-Reply-To: <20260717154943.696411-4-m.carrara@proxmox.com>

comments inline

On 7/17/26 5:50 PM, Max R. Carrara wrote:
> Add the following routes / endpoints:
> 
> * `GET plugins/storage`
>   Subdir index--lists the direct child path components (so, just
>   'plugin' currently).
> 
> * `GET plugins/storage/plugin`
>   Lists all installed storage plugins and their metadata.
>   Currently, this is just an array of objects, with each object
>   containing the plugin's `type()` and Perl module path.
> 
> * `GET plugins/storage/plugin/{type}`
>   Returns the metadata for a single plugin given by `{type}`.
> 
> Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
> ---
>  src/PVE/API2/Makefile                  |   1 +
>  src/PVE/API2/Plugins/Makefile          |  18 +++++
>  src/PVE/API2/Plugins/Storage.pm        |  54 +++++++++++++
>  src/PVE/API2/Plugins/Storage/Makefile  |  17 ++++
>  src/PVE/API2/Plugins/Storage/Plugin.pm | 104 +++++++++++++++++++++++++
>  5 files changed, 194 insertions(+)
>  create mode 100644 src/PVE/API2/Plugins/Makefile
>  create mode 100644 src/PVE/API2/Plugins/Storage.pm
>  create mode 100644 src/PVE/API2/Plugins/Storage/Makefile
>  create mode 100644 src/PVE/API2/Plugins/Storage/Plugin.pm
> 
> diff --git a/src/PVE/API2/Makefile b/src/PVE/API2/Makefile
> index fe316c52..01b7b28f 100644
> --- a/src/PVE/API2/Makefile
> +++ b/src/PVE/API2/Makefile
> @@ -5,3 +5,4 @@ install:
>  	install -D -m 0644 Disks.pm ${DESTDIR}${PERLDIR}/PVE/API2/Disks.pm
>  	make -C Storage install
>  	make -C Disks install
> +	make -C Plugins install
> diff --git a/src/PVE/API2/Plugins/Makefile b/src/PVE/API2/Plugins/Makefile
> new file mode 100644
> index 00000000..f59e75b6
> --- /dev/null
> +++ b/src/PVE/API2/Plugins/Makefile
> @@ -0,0 +1,18 @@
> +SOURCES = Storage.pm		\
> +
> +
> +SUBDIRS = Storage		\
> +
> +
> +INSTALL_PATH = ${DESTDIR}${PERLDIR}/PVE/API2/Plugins
> +
> +
> +.PHONY: install
> +install:
> +	set -e && for SOURCE in ${SOURCES}; \
> +		do install -D -m 0644 $$SOURCE ${INSTALL_PATH}/$$SOURCE; \
> +	done
> +	set -e && for SUBDIR in ${SUBDIRS}; \
> +		do make -C $$SUBDIR install; \
> +	done
> +
> diff --git a/src/PVE/API2/Plugins/Storage.pm b/src/PVE/API2/Plugins/Storage.pm
> new file mode 100644
> index 00000000..53b883fd
> --- /dev/null
> +++ b/src/PVE/API2/Plugins/Storage.pm
> @@ -0,0 +1,54 @@
> +package PVE::API2::Plugins::Storage;
> +
> +use v5.36;
> +
> +use PVE::Storage;
> +use PVE::Storage::Plugin;
> +
> +use PVE::API2::Plugins::Storage::Plugin;
> +
> +use PVE::RESTHandler;
> +use base qw(PVE::RESTHandler);

style-nit: the modules should be split into 4 groups and ordered
alphabetically per the perl style guide [0]. `PVE::RESTHandler;` is a
common module, so it belongs in the same group as `PVE::Storage*`.

I think it should look as following:

use PVE::RESTHandler;
use PVE::Storage;
use PVE::Storage::Plugin;

use PVE::API2::Plugins::Storage::Plugin;

use base qw(PVE::RESTHandler);

[0] https://pve.proxmox.com/wiki/Perl_Style_Guide#Module_Dependencies

> +
> +__PACKAGE__->register_method({
> +    subclass => 'PVE::API2::Plugins::Storage::Plugin',
> +    path => 'plugin',
> +});
> +
> +# plugins/storage
> +
> +__PACKAGE__->register_method({
> +    name => 'index',
> +    path => '',
> +    method => 'GET',
> +    description => 'Directory index.',
> +    permissions => {
> +        user => 'all',
> +    },
> +    parameters => {
> +        additionalProperties => 0,
> +        properties => {},
> +    },
> +    returns => {
> +        type => 'array',
> +        items => {
> +            type => "object",
> +            additionalProperties => 0,
> +            properties => {
> +                subdir => {
> +                    type => 'string',
> +                },
> +            },
> +        },
> +        links => [{ rel => 'child', href => "{subdir}" }],
> +    },
> +    code => sub($param) {
> +        my $result = [
> +            { subdir => 'plugin' },
> +        ];
> +
> +        return $result;
> +    },
> +});
> +
> +1;
> diff --git a/src/PVE/API2/Plugins/Storage/Makefile b/src/PVE/API2/Plugins/Storage/Makefile
> new file mode 100644
> index 00000000..06473a2f
> --- /dev/null
> +++ b/src/PVE/API2/Plugins/Storage/Makefile
> @@ -0,0 +1,17 @@
> +SOURCES = Plugin.pm		\
> +
> +
> +SUBDIRS =
> +
> +
> +INSTALL_PATH = ${DESTDIR}${PERLDIR}/PVE/API2/Plugins/Storage
> +
> +.PHONY: install
> +install:
> +	set -e && for SOURCE in ${SOURCES}; \
> +		do install -D -m 0644 $$SOURCE ${INSTALL_PATH}/$$SOURCE; \
> +	done
> +	set -e && for SUBDIR in ${SUBDIRS}; \
> +		do make -C $$SUBDIR install; \
> +	done
> +
> diff --git a/src/PVE/API2/Plugins/Storage/Plugin.pm b/src/PVE/API2/Plugins/Storage/Plugin.pm
> new file mode 100644
> index 00000000..fd0f734b
> --- /dev/null
> +++ b/src/PVE/API2/Plugins/Storage/Plugin.pm
> @@ -0,0 +1,104 @@
> +package PVE::API2::Plugins::Storage::Plugin;
> +
> +use v5.36;
> +
> +use HTTP::Status qw(:constants);
> +
> +use PVE::Exception qw(raise);
> +use PVE::Storage;
> +use PVE::Storage::Plugin;
> +use PVE::Tools qw(extract_param);
> +
> +use PVE::RESTHandler;
> +use base qw(PVE::RESTHandler);
> +

style-nit: same as above

> +my $ALL_PLUGIN_TYPES = PVE::Storage::Plugin->lookup_types();
> +[snip]




  reply	other threads:[~2026-07-20 12:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 15:49 [PATCH common/manager/proxmox-widget-toolkit/storage v2 00/17] GUI Support for Custom Storage Plugins Max R. Carrara
2026-07-17 15:49 ` [PATCH pve-common v2 01/17] json schema: add multiline string format Max R. Carrara
2026-07-17 15:49 ` [RFC pve-common v2 02/17] jsonschema: support 'patternProperties' and allow 'x-' keywords Max R. Carrara
2026-07-20 12:01   ` Jakob Klocker
2026-07-17 15:49 ` [PATCH pve-storage v2 03/17] api: plugins/storage: add initial routes and endpoints Max R. Carrara
2026-07-20 12:17   ` Jakob Klocker [this message]
2026-07-20 12:21   ` Jakob Klocker
2026-07-17 15:49 ` [PATCH pve-storage v2 04/17] api: plugins/storage/plugin: include schema in plugin metadata Max R. Carrara
2026-07-17 15:49 ` [PATCH pve-storage v2 05/17] api: plugins/storage/plugin: mark sensitive properties in schema Max R. Carrara
2026-07-17 15:49 ` [PATCH pve-storage v2 06/17] api: plugins/storage/plugin: factor plugin metadata code into helper Max R. Carrara
2026-07-17 15:49 ` [PATCH pve-storage v2 07/17] api: plugins/storage/plugin: add plugins' 'content' to their metadata Max R. Carrara
2026-07-17 15:49 ` [PATCH pve-storage v2 08/17] all plugins: add 'title' to properties, adapt 'description's Max R. Carrara
2026-07-17 15:49 ` [RFC pve-storage v2 09/17] plugin: mark 'preallocation' and 'content-dirs' properties as advanced Max R. Carrara
2026-07-17 15:49 ` [RFC pve-storage v2 10/17] plugin, dirplugin: mark certain properties as hidden Max R. Carrara
2026-07-17 15:49 ` [PATCH proxmox-widget-toolkit v2 11/17] form: introduce new 'proxmoxtextarea' field Max R. Carrara
2026-07-17 15:49 ` [PATCH proxmox-widget-toolkit v2 12/17] utils: introduce helper function getFieldDefFromPropertySchema Max R. Carrara
2026-07-17 15:49 ` [PATCH proxmox-widget-toolkit v2 13/17] acme: use helper to construct ExtJS fields from property schemas Max R. Carrara
2026-07-17 15:49 ` [PATCH pve-manager v2 14/17] api: add API routes 'plugins' and 'plugins/storage' Max R. Carrara
2026-07-20 12:26   ` Jakob Klocker
2026-07-17 15:49 ` [PATCH pve-manager v2 15/17] ui: storage view: display error when no editor for storage type exists Max R. Carrara
2026-07-17 15:49 ` [PATCH pve-manager v2 16/17] ui: storage: add basic UI integration for custom storage plugins Max R. Carrara
2026-07-17 15:49 ` [RFC pve-manager v2 17/17] ui: storage: use property extension keywords for UI hints Max R. Carrara
2026-07-18 18:19 ` [PATCH common/manager/proxmox-widget-toolkit/storage v2 00/17] GUI Support for Custom Storage Plugins Ciro Iriarte
2026-07-21  9:24   ` Max R. Carrara
2026-07-20 12:48 ` Jakob Klocker
2026-07-21  9:09   ` Max R. Carrara

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=2dbd5b88-f1b3-485e-a898-1268dcac26f4@proxmox.com \
    --to=j.klocker@proxmox.com \
    --cc=m.carrara@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal