Merge "Fix volume deletion when device mapper is used"

This commit is contained in:
Jenkins 2012-09-18 15:50:00 +00:00 committed by Gerrit Code Review
commit f615e9c22c
2 changed files with 8 additions and 0 deletions
etc/nova/rootwrap.d
nova/volume

@ -27,3 +27,7 @@ lvdisplay: CommandFilter, /sbin/lvdisplay, root
# nova/volume/driver.py: 'iscsiadm', '-m', 'node', '-T', ...
iscsiadm: CommandFilter, /sbin/iscsiadm, root
iscsiadm_usr: CommandFilter, /usr/bin/iscsiadm, root
# nova/volume/driver.py
dmsetup: CommandFilter, /sbin/dmsetup, root
dmsetup_usr: CommandFilter, /usr/sbin/dmsetup, root

@ -142,6 +142,10 @@ class VolumeDriver(object):
# 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._try_execute('dmsetup', 'remove', '-f', dev_path,
run_as_root=True)
self._try_execute('lvremove', '-f', "%s/%s" %
(FLAGS.volume_group,
self._escape_snapshot(volume['name'])),