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

Dominik Csapak d.csapak at proxmox.com
Wed Jul 19 15:45:16 CEST 2017


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)

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);
-- 
2.11.0





More information about the pve-devel mailing list