Merge "Remove utils.execute() from virt.disk.api."
This commit is contained in:
commit
48ad73e1fa
|
@ -20,7 +20,6 @@ from oslo_concurrency import processutils
|
|||
from oslo_utils import units
|
||||
|
||||
from nova import test
|
||||
from nova import utils
|
||||
from nova.virt.disk import api
|
||||
from nova.virt.disk.mount import api as mount
|
||||
from nova.virt.disk.vfs import localfs
|
||||
|
@ -51,7 +50,7 @@ class APITestCase(test.NoDBTestCase):
|
|||
self.assertFalse(api.is_image_extendable(image))
|
||||
self.assertTrue(mock_image_fs.called)
|
||||
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@mock.patch('oslo_concurrency.processutils.execute', autospec=True)
|
||||
def test_is_image_extendable_raw(self, mock_exec):
|
||||
imgfile = tempfile.NamedTemporaryFile()
|
||||
image = imgmodel.LocalFileImage(imgfile, imgmodel.FORMAT_RAW)
|
||||
|
@ -107,7 +106,7 @@ class APITestCase(test.NoDBTestCase):
|
|||
return_value=True)
|
||||
@mock.patch.object(api, 'resize2fs', autospec=True)
|
||||
@mock.patch.object(mount.Mount, 'instance_for_format')
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@mock.patch('oslo_concurrency.processutils.execute', autospec=True)
|
||||
def test_extend_qcow_success(self, mock_exec, mock_inst, mock_resize,
|
||||
mock_extendable, mock_can_resize):
|
||||
imgfile = tempfile.NamedTemporaryFile()
|
||||
|
@ -145,7 +144,7 @@ class APITestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(api, 'can_resize_image', autospec=True,
|
||||
return_value=True)
|
||||
@mock.patch.object(api, 'is_image_extendable', autospec=True)
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@mock.patch('oslo_concurrency.processutils.execute', autospec=True)
|
||||
def test_extend_qcow_no_resize(self, mock_execute, mock_extendable,
|
||||
mock_can_resize_image):
|
||||
imgfile = tempfile.NamedTemporaryFile()
|
||||
|
@ -179,7 +178,7 @@ class APITestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(api, 'can_resize_image', autospec=True,
|
||||
return_value=True)
|
||||
@mock.patch.object(api, 'resize2fs', autospec=True)
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@mock.patch('oslo_concurrency.processutils.execute', autospec=True)
|
||||
def test_extend_raw_success(self, mock_exec, mock_resize,
|
||||
mock_can_resize):
|
||||
imgfile = tempfile.NamedTemporaryFile()
|
||||
|
|
|
@ -39,7 +39,6 @@ from nova import exception
|
|||
from nova.i18n import _
|
||||
import nova.privsep.fs
|
||||
import nova.privsep.libvirt
|
||||
from nova import utils
|
||||
from nova.virt.disk.mount import api as mount
|
||||
from nova.virt.disk.vfs import api as vfs
|
||||
from nova.virt.image import model as imgmodel
|
||||
|
@ -136,7 +135,7 @@ def extend(image, size):
|
|||
nova.privsep.libvirt.ploop_resize(image.path, size)
|
||||
return
|
||||
|
||||
utils.execute('qemu-img', 'resize', image.path, size)
|
||||
processutils.execute('qemu-img', 'resize', image.path, size)
|
||||
|
||||
if (image.format != imgmodel.FORMAT_RAW and
|
||||
not CONF.resize_fs_using_block_device):
|
||||
|
@ -218,7 +217,7 @@ def is_image_extendable(image):
|
|||
else:
|
||||
# For raw, we can directly inspect the file system
|
||||
try:
|
||||
utils.execute('e2label', image.path)
|
||||
processutils.execute('e2label', image.path)
|
||||
except processutils.ProcessExecutionError as e:
|
||||
LOG.debug('Unable to determine label for image %(image)s with '
|
||||
'error %(error)s. Cannot resize.',
|
||||
|
|
Loading…
Reference in New Issue