[pve-devel] [PATCH manager 07/20] ceph: add get_storages helper

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Aug 25 10:48:09 CEST 2017


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 PVE/API2/Ceph.pm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index a1f5bebe..e7df80a2 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -787,6 +787,24 @@ my $add_storage = sub {
     }
 };
 
+my $get_storages = sub {
+    my ($pool) = @_;
+
+    my $cfg = PVE::Storage::config();
+
+    my $storages = $cfg->{ids};
+    my $res = {};
+    foreach my $storeid (keys %$storages) {
+	my $curr = $storages->{$storeid};
+	$res->{$storeid} = $storages->{$storeid}
+	    if $curr->{type} eq 'rbd' &&
+	       $curr->{pveceph} &&
+	       (!defined($pool) || $pool eq $curr->{pool});
+    }
+
+    return $res;
+};
+
 __PACKAGE__->register_method ({
     name => 'listmon',
     path => 'mon',
-- 
2.11.0





More information about the pve-devel mailing list