'short-name' is a new key that can be defined in a plugin's
`plugindata()`, containing the plugin's "colloquially used" or
abbreviated name.

For example:
- ZFS pool plugin / 'zfspool'      --> "ZFS"
- Directory plugin / 'dir'         --> "Directory"
- LVM thin pool plugin / 'lvmthin' --> "LVM-Thin"
- ... and so on.

This key is added so that custom storage plugins can define how they
are named in user interfaces and whatnot, instead of just using their
`type()`.

Optionally return 'short-name' as part of the 'plugins/storage' and
'plugins/storage/{plugin}' endpoints.

Signed-off-by: Max R. Carrara <m.carr...@proxmox.com>
---
 src/PVE/API2/Plugins/Storage/Config.pm | 4 ++++
 src/PVE/Storage/Plugin/Meta.pm         | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/PVE/API2/Plugins/Storage/Config.pm 
b/src/PVE/API2/Plugins/Storage/Config.pm
index 064aec9..2160e4e 100644
--- a/src/PVE/API2/Plugins/Storage/Config.pm
+++ b/src/PVE/API2/Plugins/Storage/Config.pm
@@ -33,6 +33,10 @@ my $PLUGIN_METADATA_SCHEMA = {
             enum => plugin_kinds(),
             optional => 0,
         },
+        'short-name' => {
+            type => 'string',
+            optional => 1,
+        },
         content => {
             type => 'object',
             optional => 0,
diff --git a/src/PVE/Storage/Plugin/Meta.pm b/src/PVE/Storage/Plugin/Meta.pm
index 6d0cb51..561c01b 100644
--- a/src/PVE/Storage/Plugin/Meta.pm
+++ b/src/PVE/Storage/Plugin/Meta.pm
@@ -134,6 +134,9 @@ my sub assemble_plugin_metadata() {
             kind => $kind,
         };
 
+        $metadata->{'short-name'} = $plugin->plugindata()->{'short-name'}
+            if defined($plugin->plugindata()->{'short-name'});
+
         $metadata->{content} = assemble_plugin_metadata_content($plugin);
         $metadata->{format} = assemble_plugin_metadata_format($plugin);
 
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to