removes all storages configured for a pool, or a single specified one. Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com> --- this one is where the {name} issue is most obvious..
PVE/API2/Ceph.pm | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm index f0414a47..7690d7a1 100644 --- a/PVE/API2/Ceph.pm +++ b/PVE/API2/Ceph.pm @@ -1669,6 +1669,52 @@ __PACKAGE__->register_method ({ }}); __PACKAGE__->register_method ({ + name => 'removestorage', + path => 'pools/{name}/storage/{storage}', + method => 'DELETE', + description => "Remove storage configuration(s) of a pool", + proxyto => 'node', + protected => 1, + permissions => { + check => [ 'perm', '/', [ 'Sys.Modify', 'Datastore.Allocate' ] ], + }, + parameters => { + additionalProperties => 0, + properties => { + node => get_standard_option('pve-node'), + name => { + description => "The name of the pool.", + type => 'string', + }, + storage => get_standard_option('pve-storage-id', { optional => 1 }), + }, + }, + returns => { type => 'null' }, + code => sub { + my ($param) = @_; + + PVE::CephTools::check_ceph_inited(); + + my $pve_ckeyring_path = PVE::CephTools::get_config('pve_ckeyring_path'); + + die "not fully configured - missing '$pve_ckeyring_path'\n" + if ! -f $pve_ckeyring_path; + + my $target_storage = $param->{storage}; + my $pool_storages = $get_storages->($param->{name}); + die "no storage named '$target_storage' for pool $param->{name}" + if $target_storage && !$pool_storages->{$target_storage}; + + foreach my $storeid (keys %$pool_storages) { + next if $target_storage && $storeid ne $target_storage; + eval { $remove_storage->($storeid); }; + warn "could not remove storage '$storeid': $@\n" if $@; + } + + return undef; + }}); + +__PACKAGE__->register_method ({ name => 'createpool', path => 'pools', method => 'POST', -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel