From: Rongze Zhu Date: Wed, 17 Jul 2013 08:34:21 +0000 (+0800) Subject: Checks the volume_clear flag and just return if it is none X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f04600a5f545baa3c947c3acadb72d14fd2ef758;p=openstack-build%2Fcinder-build.git Checks the volume_clear flag and just return if it is none Refactors the clear_volume method in LVMVolumeDriver, checks the volume_clear flag firstly and return directly if it is none. Change-Id: Id2523cfaaf61c7d6dec51c0daf6255d9de5d50f3 --- diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index a905a15db..6dcaf6dae 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -223,6 +223,9 @@ class LVMVolumeDriver(driver.VolumeDriver): def clear_volume(self, volume): """unprovision old volumes to prevent data leaking between users.""" + if self.configuration.volume_clear == 'none': + return + vol_path = self.local_path(volume) size_in_g = volume.get('size', volume.get('volume_size', None)) if size_in_g is None: @@ -231,9 +234,6 @@ class LVMVolumeDriver(driver.VolumeDriver): return size_in_m = self.configuration.volume_clear_size - if self.configuration.volume_clear == 'none': - return - LOG.info(_("Performing secure delete on volume: %s") % volume['id']) if self.configuration.volume_clear == 'zero':