3rd-party storage has "Unknown" type
Joshua Huber
jhuber at blockbridge.com
Thu Mar 31 22:39:17 CEST 2022
Hi everyone,
I maintain a Proxmox storage plugin used at several service providers
(with paying Proxmox subscriptions). We've had a few feature requests
regarding the hard-coded mapping in StorageView between backend
storage types and their user-friendly front-end names.
Any storage type that's not in pve-manager's static list is displayed
as "Unknown".
Here's the definition of StorageView's Type column:
{
header: gettext('Type'),
flex: 1,
sortable: true,
dataIndex: 'type',
renderer: PVE.Utils.format_storage_type,
},
link to repo: https://git.proxmox.com/?p=pve-manager.git;a=blob;f=www/manager6/dc/StorageView.js;h=8821b205a04162d1589a3a9792c91ab86f208dc6;hb=HEAD#l107
The format_storage_type utility function looks for a matching entry in
storageSchema, and, if found returns the corresponding name. If it's
not found, Proxmox.Utils.unknownText (which is "Unknown") is returned:
format_storage_type: function(value, md, record) {
if (value === 'rbd') {
value = !record || record.get('monhost') ? 'rbd' : 'pveceph';
} else if (value === 'cephfs') {
value = !record || record.get('monhost') ? 'cephfs' : 'pvecephfs';
}
var schema = PVE.Utils.storageSchema[value];
if (schema) {
return schema.name;
}
return Proxmox.Utils.unknownText;
}
link to repo: https://git.proxmox.com/?p=pve-manager.git;a=blob;f=www/manager6/Utils.js;h=aafe359aee5e50c5b8d7d37af7fa8e7717423fcc;hb=HEAD#l993
I've come up with a few ways to go about fixing this:
1) The simplest: if there's no entry in storageSchema for value, just
return value as the "formatted" storage type. This seems like a great
low-cost, low-risk change.
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index aafe359a..9ebd3758 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1001,7 +1001,7 @@ Ext.define('PVE.Utils', {
if (schema) {
return schema.name;
}
- return Proxmox.Utils.unknownText;
+ return value;
},
format_ha: function(value) {
2) Slightly fancier: provide a common plugin-layer configuration
option (e.g., "type_name"), which allows the storage to name itself,
and even allows the end-user to give friendlier names to different
storage pools they've defined. In pve-manager, all we need is a
different final return statement:
+ return record && record.get('type_name') || value;
And a new entry in the default storage plugin property list (in
pve-storage, PVE/Storage/Plugin.pm):
+ type_name => {
+ description => "User-friendly display name for storage",
+ type => 'string',
+ optional => 1,
+ },
This has the possible side-benefit of allowing the type name to be
used in command line tools as well as the UI, which seems like it'd be
nice for consistency.
3) Something extremely fancy: 3rd-party storage plugins bundle/provide
an associated front-end component. This is clearly superior, but is
much more involved. It could could enable adding and editing 3rd-party
via the pve-manager UI, provide a customized type name, and even a
custom icon! :)
Any of these ideas sound interesting? At this point, I'd be pretty
happy with #1 or #2 -- we don't have the time (nor really the
expertise with ExtJS) to take on the fancy option at the moment. Any
other ideas? I'm happy to submit a patch! (I'll get the CLA process
started, as well.)
Thanks in advance,
Josh
More information about the pve-devel
mailing list