[pve-devel] [v2 manager 17/27] ceph/destroypool: shorten pool variable name

Fabian Gr├╝nbichler f.gruenbichler at proxmox.com
Tue Aug 29 13:04:39 CEST 2017


Signed-off-by: Fabian Gr├╝nbichler <f.gruenbichler at proxmox.com>
---
new in v2

 PVE/API2/Ceph.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 14b8823e..1cdc2723 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -2000,6 +2000,8 @@ __PACKAGE__->register_method ({
 
 	PVE::CephTools::check_ceph_inited();
 
+	my $pool = $param->{name};
+
 	# if not forced, destroy ceph pool only when no
 	# vm disks are on it anymore
 	if (!$param->{force}) {
@@ -2007,11 +2009,11 @@ __PACKAGE__->register_method ({
 	    foreach my $storageid (keys %{$storagecfg->{ids}}) {
 		my $storage = $storagecfg->{ids}->{$storageid};
 		next if $storage->{type} ne 'rbd';
-		next if $storage->{pool} ne $param->{name};
+		next if $storage->{pool} ne $pool;
 
 		# 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"
+		die "ceph pool '$pool' still in use by storage '$storageid'\n"
 		    if @{$res->{$storageid}} != 0;
 	    }
 	}
@@ -2020,8 +2022,8 @@ __PACKAGE__->register_method ({
 	# fixme: '--yes-i-really-really-mean-it'
 	$rados->mon_command({
 	    prefix => "osd pool delete",
-	    pool => $param->{name},
-	    pool2 => $param->{name},
+	    pool => $pool,
+	    pool2 => $pool,
 	    sure => '--yes-i-really-really-mean-it',
 	    format => 'plain',
         });
-- 
2.11.0




More information about the pve-devel mailing list