[pve-devel] [PATCH manager 04/17] get storage type info in /version api call

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Aug 23 14:50:26 CEST 2017


On 07/19/2017 03:45 PM, Dominik Csapak wrote:
> this will be used in the gui, for selecting/creating disks/mps/etc.
> this means, that we get the information about a storage from
> the backend, instead of hardcoding types in the frontend
> (like the lun selector for iscsi)
> 

The api calls:
GET /storage
GET /nodes/<NAME>/storage

Have already almost all this information, missing only the whole "format" and
parts of the "content" list (the default part). This information could be simply
added there. As one of those calls must be made one way or another when using a disk/mp/efi/...
edit to get the available storages we could use it to get the needed Info, so no additional
API calls would be needed, AFAIS.

The fact that you then only get currently configured storage should not be
a problem, as disk selector can operate on existing ones anyway.

This would spare us adding additional data in the /version API call.

thoughts?

> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>   PVE/API2.pm | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/PVE/API2.pm b/PVE/API2.pm
> index 9aad03b1..329b6b79 100644
> --- a/PVE/API2.pm
> +++ b/PVE/API2.pm
> @@ -185,6 +185,16 @@ __PACKAGE__->register_method ({
>   	    $res->{$k} = $vi->{$k};
>   	}
>   
> +	# get storage formats, including custom plugins
> +	my $storages = {};
> +	my $storagetypes = PVE::Storage::Plugin->lookup_types();
> +	foreach my $type (@$storagetypes) {
> +	    my $plugin = PVE::Storage::Plugin->lookup($type);
> +	    $storages->{$type} = $plugin->plugindata();
> +	}
> +
> +	$res->{storagetypes} = $storages;
> +
>   	# get api permissions
>   
>   	$res->{cap} = $compute_api_permission->($rpcenv);
> 





More information about the pve-devel mailing list