[pve-devel] [v2 manager 11/27] ceph: implement lsstorages API path
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Aug 29 13:04:33 CEST 2017
lists storages configured for a pool
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
changes since v1:
- return krbd
- don't return monhost (not set for pveceph-managed storages anymore)
- storageS in API path
note: if the given pool name is not correct, this is currently not
detected. it would make the call vastly more expensive, as we would
need to ask Ceph for a list of pools..
PVE/API2/Ceph.pm | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 85d3159c..606b8f6b 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -1569,6 +1569,47 @@ __PACKAGE__->register_method ({
}});
__PACKAGE__->register_method ({
+ name => 'lsstorages',
+ path => 'pools/{name}/storages',
+ method => 'GET',
+ description => "List all pveceph-managed storages of a pool.",
+ proxyto => 'node',
+ protected => 1,
+ permissions => {
+ check => ['perm', '/', [ 'Sys.Audit', 'Datastore.Audit' ], any => 1],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ name => {
+ description => "The name of the pool.",
+ type => 'string',
+ },
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {
+ storage => { type => 'string' },
+ krbd => { type => 'boolean' },
+ },
+ },
+ links => [ { rel => 'child', href => "{storage}" } ],
+ },
+ code => sub {
+ my ($param) = @_;
+
+ my $storages = $get_storages->($param->{name});
+ return [ map { {
+ storage => $_,
+ krbd => $storages->{$_}->{krbd} // 0,
+ }} keys %$storages];
+ }});
+
+__PACKAGE__->register_method ({
name => 'addstorage',
path => 'pools/{name}/storages',
method => 'POST',
--
2.11.0
More information about the pve-devel
mailing list