From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 4C5E19976 for ; Fri, 1 Apr 2022 17:51:56 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4A4F029159 for ; Fri, 1 Apr 2022 17:51:56 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 4E40629150 for ; Fri, 1 Apr 2022 17:51:55 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1F9A946F5E; Fri, 1 Apr 2022 17:51:55 +0200 (CEST) Message-ID: <09a12489-229c-b8fe-99fa-64dd82330e4a@proxmox.com> Date: Fri, 1 Apr 2022 17:51:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Thunderbird/99.0 Content-Language: en-US To: Joshua Huber , PVE Devel References: From: Thomas Lamprecht In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.055 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] 3rd-party storage has "Unknown" type X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Apr 2022 15:51:56 -0000 Hi Josh, On 31.03.22 22:39, Joshua Huber wrote: =2E.. >=20 > 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. >=20 > 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; > }, >=20 > format_ha: function(value) { That's actually a good point, returning unknown here isn't really helping= anyone, especially as it's a place where we known that there can be valu= es not under Proxmox VE's control, so the value is definitively the better fallback. I pushed out a commit with your proposed 1) behavior as its a good stop-g= ap measurement in any way and doesn't harm any fancier way we may possibly a= dd in the future. https://git.proxmox.com/?p=3Dpve-manager.git;a=3Dcommitdiff;h=3Dea9b688a8= 234bbdb8cd9e0f6498bed29777a1e2c >=20 > 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: >=20 > + return record && record.get('type_name') || value; would need to be encoded to avoid HTML-element or JS injection, e.g., via= the `Ext.htmlEncode()`, besides that it would seem OK from a technical PO= V. >=20 > And a new entry in the default storage plugin property list (in > pve-storage, PVE/Storage/Plugin.pm): >=20 > + type_name =3D> { not all to hard feelings but for most new properties we use kebab case, i= =2Ee., here it'd be 'type-name' (needs the quotes then too, else perl gets confu= sed as you probably already know), but due to backward compat we got quite th= e mix present, at least in Proxmox VE (the newer, rust based PBS is quite a bit= more consistent). Possibly alternative: 'type-text' (as one could draw parallels to our JSONSchema's internal 'format-text, which is used roughly similarly for property format definitions). > + description =3D> "User-friendly display name for storage", > + type =3D> 'string', > + optional =3D> 1, adding a generous maxLength (say something between 64 to 128) and a patte= rn to avoid other whitespace-types than, well, a plain space would IMO be go= od to add. > + }, >=20 > 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. Seems like an OK argument for me, especially considering the relatively small impact. >=20 > 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! =F0=9F=98=84 >=20 Without encoding 2) would already be quite close to that, but I'd really like to avoid adding generic XSS injection as a feature ;-) >=20 > 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.) Hehe, sorry, seems like I jumped the gun on reading and already pushed ou= t 1) as a low hanging fruit before I even got to this paragraph, maybe a go= od sign to call this Friday a day and go home :-) Anyhow, if you want to for 2) then please feel free to do so. cheers, Thomas