[pve-devel] [PATCH manager 19/20] ceph/destroypool: refactor to use get_storages
Fabian Grünbichler
f.gruenbichler at proxmox.com
Fri Aug 25 10:48:21 CEST 2017
and rename variable for consistency.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
PVE/API2/Ceph.pm | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index d7877d8b..1134587b 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -2020,21 +2020,17 @@ __PACKAGE__->register_method ({
my $storages;
$storages = $get_storages->($param->{name})
- if $param->{remove_storages};
+ if $param->{remove_storages} || !$param->{force};
# if not forced, destroy ceph pool only when no
# vm disks are on it anymore
if (!$param->{force}) {
my $storagecfg = PVE::Storage::config();
- foreach my $storageid (keys %{$storagecfg->{ids}}) {
- my $storage = $storagecfg->{ids}->{$storageid};
- next if $storage->{type} ne 'rbd';
- next if $storage->{pool} ne $param->{name};
-
+ foreach my $storeid (keys %$storages) {
# check if any vm disks are on the pool
- my $res = PVE::Storage::vdisk_list($storagecfg, $storageid);
- die "ceph pool '$param->{name}' still in use by storage '$storageid'\n"
- if @{$res->{$storageid}} != 0;
+ my $res = PVE::Storage::vdisk_list($storagecfg, $storeid);
+ die "ceph pool '$param->{name}' still in use by storage '$storeid'\n"
+ if @{$res->{$storeid}} != 0;
}
}
--
2.11.0
More information about the pve-devel
mailing list