From 8b58a4605f83de6a6286ac9de2634dd3269c22b1 Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Mon, 22 Oct 2012 18:02:17 -0400 Subject: [PATCH] Ensure device node exists before wiping during volume deletion 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 1f540d159..69c9d5ae7 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -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" % -- 2.45.2