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 de4392314f)
This commit is contained in:
Eric Harney 2013-11-12 14:34:44 -05:00
parent 64878632a0
commit c9c9eaac57
2 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

@ -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.