]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Checks the volume_clear flag and just return if it is none
authorRongze Zhu <rongze@unitedstack.com>
Wed, 17 Jul 2013 08:34:21 +0000 (16:34 +0800)
committerRongze Zhu <rongze@unitedstack.com>
Wed, 17 Jul 2013 08:59:10 +0000 (16:59 +0800)
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

index a905a15db710a5a7e8d1d8be16638ea8d00ee5cc..6dcaf6dae9ddcb5a1bd2162f19e85e106be16026 100644 (file)
@@ -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':