[pve-devel] [v2 manager 08/27] ceph: add remove_storage helper

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Aug 29 13:04:30 CEST 2017


$storeid must already be validated via the API/Config
parser

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
rebased v1

 PVE/API2/Ceph.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index dfcecbec..8ba59b1f 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -755,6 +755,18 @@ my $get_storages = sub {
     return $res;
 };
 
+my $remove_storage = sub {
+    my ($storeid) = @_;
+
+    PVE::API2::Storage::Config->delete({storage => $storeid});
+
+    my $pve_ceph_keydir = PVE::CephTools::get_config('pve_ceph_keydir');
+    my $keyring = "$pve_ceph_keydir/$storeid.keyring";
+    if (-f $keyring) {
+	unlink($keyring) or warn "removing keyring of storage failed: $!\n";
+    }
+};
+
 __PACKAGE__->register_method ({
     name => 'listmon',
     path => 'mon',
-- 
2.11.0





More information about the pve-devel mailing list