From c9c9eaac573b65df671aab5c0f9ab4411557b926 Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Tue, 12 Nov 2013 14:34:44 -0500 Subject: [PATCH] Don't zero out thin provisioned LV's on delete Thin provisioned LV's don't need secure delete to protect from data leakage. Also, zeroing these out kinda defeats the purpose of using thing provisioning. This patch add a check for the lvm type and if it's thin simply returns from the lvm.clear_volume() method. Conflicts: cinder/tests/test_volume.py cinder/volume/drivers/lvm.py Change-Id: Ie6764209018152565295291efc6fbba553698ae6 Closes-Bug: #1240299 (cherry picked from commit de4392314f9b0def8fab65679ec5668aec98fbee) --- cinder/tests/test_volume.py | 2 ++ cinder/volume/drivers/lvm.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 276bea2916a..6d15dc2fcd9 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -937,6 +937,8 @@ class LVMVolumeDriverTestCase(DriverTestCase): configuration = conf.Configuration(fake_opt, 'fake_group') configuration.volume_clear = 'zero' configuration.volume_clear_size = 0 + configuration.volume_driver = \ + 'cinder.volume.drivers.lvm.LVMISCSIDriver' lvm_driver = lvm.LVMVolumeDriver(configuration=configuration) self.stubs.Set(lvm_driver, '_copy_volume', lambda *a, **kw: True) diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index 80bee47da2e..737eca119c6 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -185,9 +185,13 @@ class LVMVolumeDriver(driver.VolumeDriver): if self.configuration.volume_clear == 'none': return - if is_snapshot and ( - self.configuration.volume_driver != + # NOTE(jdg): Don't write the blocks of thin provisioned + # volumes + if (self.configuration.volume_driver == 'cinder.volume.drivers.lvm.ThinLVMVolumeDriver'): + return + + if is_snapshot: # if the volume to be cleared is a snapshot of another volume # we need to clear out the volume using the -cow instead of the # directly volume path.