From f4aae93bbf1da7859a401c1e73c1fafefc3e9254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 5 Sep 2017 14:59:35 +0200 Subject: [PATCH] ceph: add get_storages helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler --- PVE/API2/Ceph.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm index 52b425f6..0776f3c7 100644 --- a/PVE/API2/Ceph.pm +++ b/PVE/API2/Ceph.pm @@ -714,6 +714,22 @@ my $add_storage = sub { PVE::API2::Storage::Config->create($storage_params); }; +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' && $pool eq $curr->{pool}; + } + + return $res; +}; + __PACKAGE__->register_method ({ name => 'listmon', path => 'mon',