[pve-devel] pve-manager/www: API for external plugins?

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Nov 4 14:46:15 CET 2022


Hi,

Am 03/11/2022 um 11:28 schrieb Roland Kammerer:
> I'm the maintainer of the linstor-proxmox plugin and thanks to your
> storage plugin API we have a strong FLOSS and customer user base. What
> would be nice for our users is better integration in the web GUI,
> especially in "Datacenter -> Storage -> Add".
> 
> I'm not a web dev at all, I just patched in a new entry into
> pvemanagerlib.js. From what I see in the Makefile that itself is just
> the concatenated version of several .js files. Would it be possible to
> have an extra "plugin.js" that then just includes all .js from some
> /i/dont/know/plugins/ directory? I also saw that there is at least one
> dict that glues things together (storageSchema in Utils.js), so there
> probably would be some need to "register" external plugins into these
> data structures. And that is where I stop showing my entire lack of web
> development knowledge :).

We won't add any-JS includes, that's just really messy in the dynamically
prototype "mess" JS is and we cannot guarantee a safe execution at all,
which for the Storage plugin backend is at least only the admin-owned
server, that the admin setups themselves anyway, not all users through
all browsers.

Iff, there needs a more schematic approach provided by the backend via an
schema-checked API call, more on that below.

> 
> Could you provide some kind of API that allows external plugins to
> integrate into the GUI? Or maybe it even exists and I did not see it?
> 

No, there's no functionality at the moment. We got such a request also from
the quite active BlockBridge devs, and my reply[0] contains some hints in
how one could achieve that, in short, similar to how we handle the more
popular ones from the huge amount of different acme.sh plugins, via a
schema[1][2] that gets dynamically translated to a form in the web
interface[3].

If done somewhat nicely and safely we'd accept such a thing, the plugins
would get an new method (e.g., api_schema) that returns a perl hash ref
containing the properties including type, description and flags like if the
setting is editable (after storage addition), and a new API endpoint
returning the schema's of all (external) plugins similar so that they can be
shown in the add Drop down and used for creating the basic form.

Do you want to work on something like that? We can try to help on questions,
review and with some polishing, but the major effort may need to come from
parties interested in this, but maybe the BlockBridge devs (I CCd Ilya, hope
that was OK) are still interested in that too, and can help, if only by
verifying that the solution is generic enough to be useful to more than one
specific external Plugin.

regards,
Thomas

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=3420#c1
[1]: https://git.proxmox.com/?p=proxmox-acme.git;a=blob;f=src/dns-challenge-schema.README;h=1de1cd115a765e1d1917733db84c21a6c952a441;hb=HEAD
[2]: https://git.proxmox.com/?p=proxmox-acme.git;a=blob;f=src/dns-challenge-schema.json;h=39ac2babdd5eef71d5a31216375bc970098bad76;hb=HEAD
[3]: https://git.proxmox.com/?p=pve-manager.git;a=blob;f=www/manager6/dc/ACMEPluginEdit.js;h=570b4dd20038c49ddd2b68153e672b8deae0cf4d;hb=HEAD#l19





More information about the pve-devel mailing list