From f04600a5f545baa3c947c3acadb72d14fd2ef758 Mon Sep 17 00:00:00 2001 From: Rongze Zhu Date: Wed, 17 Jul 2013 16:34:21 +0800 Subject: [PATCH] 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 --- cinder/volume/drivers/lvm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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': -- 2.45.2