Merge "Re-using the code of os brick cinder"
This commit is contained in:
commit
2e80f99508
|
@ -75,11 +75,6 @@ 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)
|
||||
|
|
|
@ -118,7 +118,7 @@ class LvmTestCase(test.NoDBTestCase):
|
|||
lvm.clear_volume('/dev/foo')
|
||||
|
||||
@mock.patch.object(lvm, 'clear_volume')
|
||||
@mock.patch('nova.privsep.fs.lvremove',
|
||||
@mock.patch('os_brick.local_dev.lvm.LVM.delete',
|
||||
side_effect=processutils.ProcessExecutionError('Error'))
|
||||
def test_fail_remove_all_logical_volumes(self, mock_clear, mock_lvremove):
|
||||
self.assertRaises(exception.VolumesNotRemoved,
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
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
|
||||
|
@ -186,7 +187,7 @@ def remove_volumes(paths):
|
|||
for path in paths:
|
||||
clear_volume(path)
|
||||
try:
|
||||
nova.privsep.fs.lvremove(path)
|
||||
brick_lvm.LVM.delete(path)
|
||||
except processutils.ProcessExecutionError as exp:
|
||||
errors.append(six.text_type(exp))
|
||||
if errors:
|
||||
|
|
Loading…
Reference in New Issue