Merge "Revert "Re-using the code of os brick cinder""

This commit is contained in:
Zuul 2018-06-19 02:08:34 +00:00 committed by Gerrit Code Review
commit 3cbb7b861c
3 changed files with 7 additions and 3 deletions

View File

@ -75,6 +75,11 @@ def lvinfo(path):
'--separator', '|', path)
@nova.privsep.sys_admin_pctxt.entrypoint
def lvremove(path):
processutils.execute('lvremove', '-f', path, attempts=3)
@nova.privsep.sys_admin_pctxt.entrypoint
def blockdev_size(path):
return processutils.execute('blockdev', '--getsize64', path)

View File

@ -118,7 +118,7 @@ class LvmTestCase(test.NoDBTestCase):
lvm.clear_volume('/dev/foo')
@mock.patch.object(lvm, 'clear_volume')
@mock.patch('os_brick.local_dev.lvm.LVM.delete',
@mock.patch('nova.privsep.fs.lvremove',
side_effect=processutils.ProcessExecutionError('Error'))
def test_fail_remove_all_logical_volumes(self, mock_clear, mock_lvremove):
self.assertRaises(exception.VolumesNotRemoved,

View File

@ -21,7 +21,6 @@
import os
from os_brick.local_dev import lvm as brick_lvm
from oslo_concurrency import processutils
from oslo_log import log as logging
from oslo_utils import units
@ -187,7 +186,7 @@ def remove_volumes(paths):
for path in paths:
clear_volume(path)
try:
brick_lvm.LVM.delete(path)
nova.privsep.fs.lvremove(path)
except processutils.ProcessExecutionError as exp:
errors.append(six.text_type(exp))
if errors: