Remove utils.execute() from quobyte libvirt storage driver.

Choppy choppy.

Change-Id: I21b7b14be8064211bfe9699ec9a9ad2bedd73519
This commit is contained in:
Michael Still 2018-11-23 15:33:30 +11:00
parent 08d617084e
commit c08e43314d
2 changed files with 12 additions and 12 deletions

View File

@ -61,7 +61,7 @@ class QuobyteTestCase(test.NoDBTestCase):
@mock.patch.object(os.path, "exists", return_value=False)
@mock.patch.object(fileutils, "ensure_tree")
@mock.patch.object(utils, "execute")
@mock.patch('oslo_concurrency.processutils.execute')
def test_quobyte_mount_volume_not_systemd(self, mock_execute,
mock_ensure_tree,
mock_exists):
@ -83,7 +83,7 @@ class QuobyteTestCase(test.NoDBTestCase):
@mock.patch.object(os.path, "exists", return_value=True)
@mock.patch.object(fileutils, "ensure_tree")
@mock.patch.object(utils, "execute")
@mock.patch('oslo_concurrency.processutils.execute')
def test_quobyte_mount_volume_systemd(self, mock_execute,
mock_ensure_tree,
mock_exists):
@ -108,7 +108,7 @@ class QuobyteTestCase(test.NoDBTestCase):
@mock.patch.object(os.path, "exists", return_value=False)
@mock.patch.object(fileutils, "ensure_tree")
@mock.patch.object(utils, "execute")
@mock.patch('oslo_concurrency.processutils.execute')
def test_quobyte_mount_volume_with_config(self,
mock_execute,
mock_ensure_tree,
@ -135,9 +135,9 @@ class QuobyteTestCase(test.NoDBTestCase):
mock_exists.assert_called_once_with(" /run/systemd/system")
@mock.patch.object(fileutils, "ensure_tree")
@mock.patch.object(utils, "execute",
side_effect=(processutils.
ProcessExecutionError))
@mock.patch('oslo_concurrency.processutils.execute',
side_effect=(processutils.
ProcessExecutionError))
def test_quobyte_mount_volume_fails(self, mock_execute, mock_ensure_tree):
mnt_base = '/mnt'
quobyte_volume = '192.168.1.1/volume-00001'
@ -149,7 +149,7 @@ class QuobyteTestCase(test.NoDBTestCase):
quobyte_volume,
export_mnt_base)
@mock.patch.object(utils, "execute")
@mock.patch('oslo_concurrency.processutils.execute')
def test_quobyte_umount_volume(self, mock_execute):
mnt_base = '/mnt'
quobyte_volume = '192.168.1.1/volume-00001'
@ -162,7 +162,7 @@ class QuobyteTestCase(test.NoDBTestCase):
export_mnt_base)
@mock.patch.object(quobyte.LOG, "error")
@mock.patch.object(utils, "execute")
@mock.patch('oslo_concurrency.processutils.execute')
def test_quobyte_umount_volume_warns(self,
mock_execute,
mock_debug):
@ -184,8 +184,8 @@ class QuobyteTestCase(test.NoDBTestCase):
export_mnt_base))
@mock.patch.object(quobyte.LOG, "exception")
@mock.patch.object(utils, "execute",
side_effect=(processutils.ProcessExecutionError))
@mock.patch('oslo_concurrency.processutils.execute',
side_effect=(processutils.ProcessExecutionError))
def test_quobyte_umount_volume_fails(self,
mock_execute,
mock_exception):

View File

@ -58,14 +58,14 @@ def mount_volume(volume, mnt_base, configfile=None):
LOG.debug('Mounting volume %s at mount point %s ...',
volume,
mnt_base)
utils.execute(*command)
processutils.execute(*command)
LOG.info('Mounted volume: %s', volume)
def umount_volume(mnt_base):
"""Wraps execute calls for unmouting a Quobyte volume"""
try:
utils.execute('umount.quobyte', mnt_base)
processutils.execute('umount.quobyte', mnt_base)
except processutils.ProcessExecutionError as exc:
if 'Device or resource busy' in six.text_type(exc):
LOG.error("The Quobyte volume at %s is still in use.", mnt_base)