Re-using the code of os brick cinder

To avoid the errors during force delete of logical volume,
cinder library os brick is already using udevadm settle for it.
Calling the same library of cinder in nova too.

Change-Id: I092afdd0409ab27187cf74cd1514e9e0c550d52c
Closes-Bug: #1191960
This commit is contained in:
Vishakha Agarwal 2018-05-02 16:42:58 +05:30
parent 324899c621
commit 8b8c5da59e
3 changed files with 3 additions and 7 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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: