[pve-devel] [PATCH manager v3 07/20] ceph: add get_storages helper
Fabian Grünbichler
f.gruenbichler at proxmox.com
Thu Aug 31 11:38:10 CEST 2017
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
changes since v2:
-return all rbd storages of pool, not only pveceph ones
PVE/API2/Ceph.pm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 2fd47207..207654b0 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -715,6 +715,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',
--
2.11.0
More information about the pve-devel
mailing list