From c08e43314de1d39cf24d933ae18b45b76f5cf94c Mon Sep 17 00:00:00 2001 From: Michael Still Date: Fri, 23 Nov 2018 15:33:30 +1100 Subject: [PATCH] Remove utils.execute() from quobyte libvirt storage driver. Choppy choppy. Change-Id: I21b7b14be8064211bfe9699ec9a9ad2bedd73519 --- .../unit/virt/libvirt/volume/test_quobyte.py | 20 +++++++++---------- nova/virt/libvirt/volume/quobyte.py | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py index 1c50f45e8a3b..e84b9472c342 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py +++ b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py @@ -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): diff --git a/nova/virt/libvirt/volume/quobyte.py b/nova/virt/libvirt/volume/quobyte.py index 7641bfc6e392..e0885931cdc3 100644 --- a/nova/virt/libvirt/volume/quobyte.py +++ b/nova/virt/libvirt/volume/quobyte.py @@ -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)