From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 29ED81FF0B7 for ; Fri, 13 Nov 2026 21:34:36 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 0FF3B216F8; Fri, 13 Nov 2026 21:34:06 +0100 (CET) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage v5 06/19] api: plugins/storage/plugin: add plugins' 'content' to their metadata Date: Fri, 13 Nov 2026 21:33:10 +0100 Message-ID: <20261113203330.932813-7-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261113203330.932813-1-m.carrara@proxmox.com> References: <20261113203330.932813-1-m.carrara@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794602023064 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.294 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: O4YIB6KOWZONLJPB5GJ3DJRZ7OSCCMYK X-Message-ID-Hash: O4YIB6KOWZONLJPB5GJ3DJRZ7OSCCMYK X-MailFrom: m.carrara@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Alfonso Kuen , Thomas Ellmenreich , Jakob Klocker X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Return the content types that a plugin supports, as well as the ones it enables by default, from the 'content' entry of its `plugindata()`. The UI needs these to offer only the supported content types when adding or editing a storage of a custom plugin, and to preselect the default ones when adding it. This information is not part of the property schema, as the 'content' property is shared by all plugins. Signed-off-by: Max R. Carrara --- src/PVE/API2/Plugins/Storage/Plugin.pm | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/PVE/API2/Plugins/Storage/Plugin.pm b/src/PVE/API2/Plugins/Storage/Plugin.pm index 82ad9f8e..e243ed81 100644 --- a/src/PVE/API2/Plugins/Storage/Plugin.pm +++ b/src/PVE/API2/Plugins/Storage/Plugin.pm @@ -22,10 +22,33 @@ my sub plugin_origin($plugin) { my $PLUGIN_METADATA_SCHEMA = { type => 'object', additionalProperties => 0, properties => { + content => { + description => "The content types of the plugin.", + type => 'object', + optional => 0, + properties => { + supported => { + description => "The content types the plugin supports.", + type => 'array', + optional => 0, + items => { + type => 'string', + }, + }, + default => { + description => "The content types enabled by default.", + type => 'array', + optional => 0, + items => { + type => 'string', + }, + }, + }, + }, origin => { description => "Whether the plugin is shipped with Proxmox VE ('builtin') or" . " installed separately ('custom').", type => 'string', enum => $PLUGIN_ORIGINS, @@ -104,12 +127,17 @@ my sub get_schema_for_plugin : prototype($) ($plugin) { return $schema; } my sub build_plugin_metadata($type) { my $plugin = PVE::Storage::Plugin->lookup($type); + my $plugindata = $plugin->plugindata(); return { + content => { + supported => [sort keys $plugindata->{content}->[0]->%*], + default => [sort keys $plugindata->{content}->[1]->%*], + }, origin => plugin_origin($plugin), schema => get_schema_for_plugin($plugin), type => $type, }; } -- 2.47.3