Merge "Ensure device node exists before wiping during volume deletion"

This commit is contained in:
Jenkins 2012-10-22 22:39:03 +00:00 committed by Gerrit Code Review
commit 00251c0e16

View File

@ -147,9 +147,9 @@ class VolumeDriver(object):
"""Deletes a logical volume."""
# zero out old volumes to prevent data leaking between users
# TODO(ja): reclaiming space should be done lazy and low priority
self._copy_volume('/dev/zero', self.local_path(volume), size_in_g)
dev_path = self.local_path(volume)
if os.path.exists(dev_path):
self._copy_volume('/dev/zero', dev_path, size_in_g)
self._try_execute('dmsetup', 'remove', '-f', dev_path,
run_as_root=True)
self._try_execute('lvremove', '-f', "%s/%s" %