Merge "Remove the final user of utils.execute() from virt.images"

This commit is contained in:
Zuul 2018-12-17 00:39:52 +00:00 committed by Gerrit Code Review
commit 95a5ae3065
3 changed files with 7 additions and 9 deletions

View File

@ -17689,7 +17689,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
@mock.patch('os.path.exists')
@mock.patch('os.path.getsize')
@mock.patch('os.path.isdir')
@mock.patch('nova.utils.execute')
@mock.patch('oslo_concurrency.processutils.execute')
@mock.patch.object(host.Host, '_get_domain')
def test_get_instance_disk_info_parallels_ct(self, mock_get_domain,
mock_execute,

View File

@ -21,7 +21,6 @@ import six
from nova.compute import utils as compute_utils
from nova import exception
from nova import test
from nova import utils
from nova.virt import images
@ -31,7 +30,7 @@ class QemuTestCase(test.NoDBTestCase):
images.qemu_img_info,
'/path/that/does/not/exist')
@mock.patch.object(utils, 'execute')
@mock.patch('oslo_concurrency.processutils.execute')
@mock.patch.object(os.path, 'exists', return_value=True)
def test_qemu_info_with_errors(self, path_exists, mock_exec):
err = processutils.ProcessExecutionError(
@ -42,8 +41,8 @@ class QemuTestCase(test.NoDBTestCase):
'/fake/path')
@mock.patch.object(os.path, 'exists', return_value=True)
@mock.patch.object(utils, 'execute',
return_value=('stdout', None))
@mock.patch('oslo_concurrency.processutils.execute',
return_value=('stdout', None))
def test_qemu_info_with_no_errors(self, path_exists,
utils_execute):
image_info = images.qemu_img_info('/fake/path')
@ -64,7 +63,7 @@ class QemuTestCase(test.NoDBTestCase):
'raw')
mock_disk_op_sema.__enter__.assert_called_once()
@mock.patch.object(utils, 'execute')
@mock.patch('oslo_concurrency.processutils.execute')
@mock.patch.object(os.path, 'exists', return_value=True)
def test_convert_image_with_prlimit_fail(self, path, mocked_execute):
mocked_execute.side_effect = \
@ -74,7 +73,7 @@ class QemuTestCase(test.NoDBTestCase):
'/fake/path')
self.assertIn('qemu-img aborted by prlimits', six.text_type(exc))
@mock.patch.object(utils, 'execute')
@mock.patch('oslo_concurrency.processutils.execute')
@mock.patch.object(os.path, 'exists', return_value=True)
def test_qemu_img_info_with_disk_not_found(self, exists, mocked_execute):
"""Tests that the initial os.path.exists check passes but the qemu-img

View File

@ -34,7 +34,6 @@ from nova import exception
from nova.i18n import _
from nova import image
import nova.privsep.qemu
from nova import utils
LOG = logging.getLogger(__name__)
@ -72,7 +71,7 @@ def qemu_img_info(path, format=None):
# to add the --force-share flag.
if QEMU_VERSION and operator.ge(QEMU_VERSION, QEMU_VERSION_REQ_SHARED):
cmd = cmd + ('--force-share',)
out, err = utils.execute(*cmd, prlimit=QEMU_IMG_LIMITS)
out, err = processutils.execute(*cmd, prlimit=QEMU_IMG_LIMITS)
except processutils.ProcessExecutionError as exp:
if exp.exit_code == -9:
# this means we hit prlimits, make the exception more specific