]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Ensure device node exists before wiping during volume deletion
authorEric Harney <eharney@redhat.com>
Mon, 22 Oct 2012 22:02:17 +0000 (18:02 -0400)
committerEric Harney <eharney@redhat.com>
Mon, 22 Oct 2012 22:02:17 +0000 (18:02 -0400)
If the LVM device node is missing when a Cinder volume is deleted,
a large amount of data will be written to /dev/.  Check that the
device node exists before performing a _copy_volume('/dev/zero'...)
to wipe it.  Fixes bug 1070023.

Change-Id: I77a0a5545a54a4adc905a781ed8120db7adccc27

cinder/volume/driver.py

index 1f540d15996fa83c0b7ab0b43a196a5614459ac5..69c9d5ae76060e8aacc7815b21bb377581c2f736 100644 (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" %