From 6be85774aec674eef7bfbf66f8885a4531c7c605 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Tue, 7 May 2013 20:51:24 +1000 Subject: Convert to using newly imported processutils. This change moves nova over to using the newly imported trycmd() and ssh_execute() implementations from oslo's processutils. Change-Id: Ied2bb1eeb0cbdc6903a4028a60c89ca9e23656b4 --- nova/tests/baremetal/test_virtual_power_driver.py | 15 ++- nova/tests/fake_processutils.py | 111 +++++++++++++++++++++ nova/tests/fake_utils.py | 112 --------------------- nova/tests/test_imagebackend.py | 14 +-- nova/tests/test_virt_disk_vfs_localfs.py | 115 +++++++++++++++------- nova/tests/test_xenapi.py | 10 +- 6 files changed, 207 insertions(+), 170 deletions(-) create mode 100644 nova/tests/fake_processutils.py delete mode 100644 nova/tests/fake_utils.py (limited to 'nova/tests') diff --git a/nova/tests/baremetal/test_virtual_power_driver.py b/nova/tests/baremetal/test_virtual_power_driver.py index 4cac0a3ba..d6d615194 100644 --- a/nova/tests/baremetal/test_virtual_power_driver.py +++ b/nova/tests/baremetal/test_virtual_power_driver.py @@ -27,7 +27,6 @@ from nova.tests.baremetal.db import base as bm_db_base from nova.tests.baremetal.db import utils as bm_db_utils from nova.tests.image import fake as fake_image from nova.tests import utils -from nova import utils as nutils from nova.virt.baremetal import db from nova.virt.baremetal import virtual_power_driver import nova.virt.powervm.common as connection @@ -352,9 +351,9 @@ class VPDClassMethodsTestCase(BareMetalVPDTestCase): self._create_pm() self.mox.StubOutWithMock(self.pm, '_set_connection') - self.mox.StubOutWithMock(nutils, 'ssh_execute') + self.mox.StubOutWithMock(processutils, 'ssh_execute') self.pm._set_connection().AndReturn(True) - nutils.ssh_execute(None, '/usr/bin/VBoxManage test return', + processutils.ssh_execute(None, '/usr/bin/VBoxManage test return', check_exit_code=True).AndReturn(("test\nreturn", "")) self.pm._matched_name = 'testNode' self.mox.ReplayAll() @@ -367,10 +366,10 @@ class VPDClassMethodsTestCase(BareMetalVPDTestCase): self._create_pm() self.mox.StubOutWithMock(self.pm, '_set_connection') - self.mox.StubOutWithMock(nutils, 'ssh_execute') + self.mox.StubOutWithMock(processutils, 'ssh_execute') self.pm._set_connection().AndReturn(True) - nutils.ssh_execute(None, '/usr/bin/VBoxManage test return', + processutils.ssh_execute(None, '/usr/bin/VBoxManage test return', check_exit_code=True).\ AndRaise(processutils.ProcessExecutionError) self.mox.ReplayAll() @@ -384,14 +383,14 @@ class VPDClassMethodsTestCase(BareMetalVPDTestCase): self._create_pm() self.mox.StubOutWithMock(self.pm, '_check_for_node') - self.mox.StubOutWithMock(nutils, 'ssh_execute') + self.mox.StubOutWithMock(processutils, 'ssh_execute') self.pm._check_for_node().AndReturn(['"testNode"']) self.pm._check_for_node().AndReturn(['"testNode"']) - nutils.ssh_execute('test', '/usr/bin/VBoxManage startvm ', + processutils.ssh_execute('test', '/usr/bin/VBoxManage startvm ', check_exit_code=True).\ AndRaise(processutils.ProcessExecutionError) - nutils.ssh_execute('test', '/usr/bin/VBoxManage list runningvms', + processutils.ssh_execute('test', '/usr/bin/VBoxManage list runningvms', check_exit_code=True).\ AndRaise(processutils.ProcessExecutionError) diff --git a/nova/tests/fake_processutils.py b/nova/tests/fake_processutils.py new file mode 100644 index 000000000..04d39e7e5 --- /dev/null +++ b/nova/tests/fake_processutils.py @@ -0,0 +1,111 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright (c) 2011 Citrix Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""This modules stubs out functions in openstack.common.processutils.""" + +import re + +from eventlet import greenthread + +from nova.openstack.common import log as logging +from nova.openstack.common import processutils + +LOG = logging.getLogger(__name__) + +_fake_execute_repliers = [] +_fake_execute_log = [] + + +def fake_execute_get_log(): + return _fake_execute_log + + +def fake_execute_clear_log(): + global _fake_execute_log + _fake_execute_log = [] + + +def fake_execute_set_repliers(repliers): + """Allows the client to configure replies to commands.""" + global _fake_execute_repliers + _fake_execute_repliers = repliers + + +def fake_execute_default_reply_handler(*ignore_args, **ignore_kwargs): + """A reply handler for commands that haven't been added to the reply list. + + Returns empty strings for stdout and stderr. + + """ + return '', '' + + +def fake_execute(*cmd_parts, **kwargs): + """This function stubs out execute. + + It optionally executes a preconfigued function to return expected data. + + """ + global _fake_execute_repliers + + process_input = kwargs.get('process_input', None) + check_exit_code = kwargs.get('check_exit_code', 0) + delay_on_retry = kwargs.get('delay_on_retry', True) + attempts = kwargs.get('attempts', 1) + run_as_root = kwargs.get('run_as_root', False) + cmd_str = ' '.join(str(part) for part in cmd_parts) + + LOG.debug(_("Faking execution of cmd (subprocess): %s"), cmd_str) + _fake_execute_log.append(cmd_str) + + reply_handler = fake_execute_default_reply_handler + + for fake_replier in _fake_execute_repliers: + if re.match(fake_replier[0], cmd_str): + reply_handler = fake_replier[1] + LOG.debug(_('Faked command matched %s') % fake_replier[0]) + break + + if isinstance(reply_handler, basestring): + # If the reply handler is a string, return it as stdout + reply = reply_handler, '' + else: + try: + # Alternative is a function, so call it + reply = reply_handler(cmd_parts, + process_input=process_input, + delay_on_retry=delay_on_retry, + attempts=attempts, + run_as_root=run_as_root, + check_exit_code=check_exit_code) + except processutils.ProcessExecutionError as e: + LOG.debug(_('Faked command raised an exception %s'), e) + raise + + stdout = reply[0] + stderr = reply[1] + LOG.debug(_("Reply to faked command is stdout='%(stdout)s' " + "stderr='%(stderr)s'") % locals()) + + # Replicate the sleep call in the real function + greenthread.sleep(0) + return reply + + +def stub_out_processutils_execute(stubs): + fake_execute_set_repliers([]) + fake_execute_clear_log() + stubs.Set(processutils, 'execute', fake_execute) diff --git a/nova/tests/fake_utils.py b/nova/tests/fake_utils.py deleted file mode 100644 index 6a295b43b..000000000 --- a/nova/tests/fake_utils.py +++ /dev/null @@ -1,112 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright (c) 2011 Citrix Systems, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""This modules stubs out functions in nova.utils.""" - -import re - -from eventlet import greenthread - -from nova.openstack.common import log as logging -from nova.openstack.common import processutils -from nova import utils - -LOG = logging.getLogger(__name__) - -_fake_execute_repliers = [] -_fake_execute_log = [] - - -def fake_execute_get_log(): - return _fake_execute_log - - -def fake_execute_clear_log(): - global _fake_execute_log - _fake_execute_log = [] - - -def fake_execute_set_repliers(repliers): - """Allows the client to configure replies to commands.""" - global _fake_execute_repliers - _fake_execute_repliers = repliers - - -def fake_execute_default_reply_handler(*ignore_args, **ignore_kwargs): - """A reply handler for commands that haven't been added to the reply list. - - Returns empty strings for stdout and stderr. - - """ - return '', '' - - -def fake_execute(*cmd_parts, **kwargs): - """This function stubs out execute. - - It optionally executes a preconfigued function to return expected data. - - """ - global _fake_execute_repliers - - process_input = kwargs.get('process_input', None) - check_exit_code = kwargs.get('check_exit_code', 0) - delay_on_retry = kwargs.get('delay_on_retry', True) - attempts = kwargs.get('attempts', 1) - run_as_root = kwargs.get('run_as_root', False) - cmd_str = ' '.join(str(part) for part in cmd_parts) - - LOG.debug(_("Faking execution of cmd (subprocess): %s"), cmd_str) - _fake_execute_log.append(cmd_str) - - reply_handler = fake_execute_default_reply_handler - - for fake_replier in _fake_execute_repliers: - if re.match(fake_replier[0], cmd_str): - reply_handler = fake_replier[1] - LOG.debug(_('Faked command matched %s') % fake_replier[0]) - break - - if isinstance(reply_handler, basestring): - # If the reply handler is a string, return it as stdout - reply = reply_handler, '' - else: - try: - # Alternative is a function, so call it - reply = reply_handler(cmd_parts, - process_input=process_input, - delay_on_retry=delay_on_retry, - attempts=attempts, - run_as_root=run_as_root, - check_exit_code=check_exit_code) - except processutils.ProcessExecutionError as e: - LOG.debug(_('Faked command raised an exception %s'), e) - raise - - stdout = reply[0] - stderr = reply[1] - LOG.debug(_("Reply to faked command is stdout='%(stdout)s' " - "stderr='%(stderr)s'") % locals()) - - # Replicate the sleep call in the real function - greenthread.sleep(0) - return reply - - -def stub_out_utils_execute(stubs): - fake_execute_set_repliers([]) - fake_execute_clear_log() - stubs.Set(utils, 'execute', fake_execute) diff --git a/nova/tests/test_imagebackend.py b/nova/tests/test_imagebackend.py index d571bbf9e..445ec55cf 100644 --- a/nova/tests/test_imagebackend.py +++ b/nova/tests/test_imagebackend.py @@ -23,7 +23,7 @@ from oslo.config import cfg from nova.openstack.common import uuidutils from nova import test from nova.tests import fake_libvirt_utils -from nova.tests import fake_utils +from nova.tests import fake_processutils from nova.virt.libvirt import imagebackend CONF = cfg.CONF @@ -130,8 +130,8 @@ class _ImageTestCase(object): def test_prealloc_image(self): CONF.set_override('preallocate_images', 'space') - fake_utils.fake_execute_clear_log() - fake_utils.stub_out_utils_execute(self.stubs) + fake_processutils.fake_execute_clear_log() + fake_processutils.stub_out_processutils_execute(self.stubs) image = self.image_class(self.INSTANCE, self.NAME) def fake_fetch(target, *args, **kwargs): @@ -143,7 +143,7 @@ class _ImageTestCase(object): image.cache(fake_fetch, self.TEMPLATE_PATH, self.SIZE) image.cache(fake_fetch, self.TEMPLATE_PATH, self.SIZE) - self.assertEqual(fake_utils.fake_execute_get_log(), + self.assertEqual(fake_processutils.fake_execute_get_log(), ['fallocate -n -l 1 %s.fallocate_test' % self.PATH, 'fallocate -n -l %s %s' % (self.SIZE, self.PATH), 'fallocate -n -l %s %s' % (self.SIZE, self.PATH)]) @@ -406,8 +406,8 @@ class LvmTestCase(_ImageTestCase, test.TestCase): def test_prealloc_image(self): CONF.set_override('preallocate_images', 'space') - fake_utils.fake_execute_clear_log() - fake_utils.stub_out_utils_execute(self.stubs) + fake_processutils.fake_execute_clear_log() + fake_processutils.stub_out_processutils_execute(self.stubs) image = self.image_class(self.INSTANCE, self.NAME) def fake_fetch(target, *args, **kwargs): @@ -417,7 +417,7 @@ class LvmTestCase(_ImageTestCase, test.TestCase): image.cache(fake_fetch, self.TEMPLATE_PATH, self.SIZE) - self.assertEqual(fake_utils.fake_execute_get_log(), []) + self.assertEqual(fake_processutils.fake_execute_get_log(), []) class BackendTestCase(test.TestCase): diff --git a/nova/tests/test_virt_disk_vfs_localfs.py b/nova/tests/test_virt_disk_vfs_localfs.py index 5bbac670e..b52817b18 100644 --- a/nova/tests/test_virt_disk_vfs_localfs.py +++ b/nova/tests/test_virt_disk_vfs_localfs.py @@ -14,13 +14,17 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.config import cfg + from nova import exception +from nova.openstack.common import processutils from nova import test from nova.tests import utils as tests_utils -from nova import utils from nova.virt.disk.vfs import localfs as vfsimpl +CONF = cfg.CONF + dirs = [] files = {} commands = [] @@ -121,13 +125,13 @@ class VirtDiskVFSLocalFSTestPaths(test.TestCase): def setUp(self): super(VirtDiskVFSLocalFSTestPaths, self).setUp() - real_execute = utils.execute + real_execute = processutils.execute def nonroot_execute(*cmd_parts, **kwargs): kwargs.pop('run_as_root', None) return real_execute(*cmd_parts, **kwargs) - self.stubs.Set(utils, 'execute', nonroot_execute) + self.stubs.Set(processutils, 'execute', nonroot_execute) def test_check_safe_path(self): if tests_utils.is_osx(): @@ -152,7 +156,7 @@ class VirtDiskVFSLocalFSTest(test.TestCase): global dirs, commands dirs = [] commands = [] - self.stubs.Set(utils, 'execute', fake_execute) + self.stubs.Set(processutils, 'execute', fake_execute) vfs = vfsimpl.VFSLocalFS(imgfile="/dummy.qcow2", imgfmt="qcow2") vfs.imgdir = "/scratch/dir" @@ -162,25 +166,30 @@ class VirtDiskVFSLocalFSTest(test.TestCase): self.assertEqual(dirs, ["/scratch/dir/some/dir", "/scratch/dir/other/dir"]), + root_helper = 'sudo nova-rootwrap %s' % CONF.rootwrap_config self.assertEqual(commands, [{'args': ('readlink', '-nm', '/scratch/dir/some/dir'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('mkdir', '-p', '/scratch/dir/some/dir'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('readlink', '-nm', '/scratch/dir/other/dir'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('mkdir', '-p', '/scratch/dir/other/dir'), - 'kwargs': {'run_as_root': True}}]) + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}]) def test_append_file(self): global files, commands files = {} commands = [] - self.stubs.Set(utils, 'execute', fake_execute) + self.stubs.Set(processutils, 'execute', fake_execute) vfs = vfsimpl.VFSLocalFS(imgfile="/dummy.qcow2", imgfmt="qcow2") vfs.imgdir = "/scratch/dir" @@ -190,20 +199,23 @@ class VirtDiskVFSLocalFSTest(test.TestCase): self.assertEquals(files["/scratch/dir/some/file"]["content"], "Hello World Goodbye") + root_helper = 'sudo nova-rootwrap %s' % CONF.rootwrap_config self.assertEqual(commands, [{'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('tee', '-a', '/scratch/dir/some/file'), 'kwargs': {'process_input': ' Goodbye', - 'run_as_root': True}}]) + 'run_as_root': True, + 'root_helper': root_helper}}]) def test_replace_file(self): global files, commands files = {} commands = [] - self.stubs.Set(utils, 'execute', fake_execute) + self.stubs.Set(processutils, 'execute', fake_execute) vfs = vfsimpl.VFSLocalFS(imgfile="/dummy.qcow2", imgfmt="qcow2") vfs.imgdir = "/scratch/dir" @@ -213,36 +225,42 @@ class VirtDiskVFSLocalFSTest(test.TestCase): self.assertEquals(files["/scratch/dir/some/file"]["content"], "Goodbye") + root_helper = 'sudo nova-rootwrap %s' % CONF.rootwrap_config self.assertEqual(commands, [{'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('tee', '/scratch/dir/some/file'), 'kwargs': {'process_input': 'Goodbye', - 'run_as_root': True}}]) + 'run_as_root': True, + 'root_helper': root_helper}}]) def test_read_file(self): global commands, files files = {} commands = [] - self.stubs.Set(utils, 'execute', fake_execute) + self.stubs.Set(processutils, 'execute', fake_execute) vfs = vfsimpl.VFSLocalFS(imgfile="/dummy.qcow2", imgfmt="qcow2") vfs.imgdir = "/scratch/dir" self.assertEqual(vfs.read_file("/some/file"), "Hello World") + root_helper = 'sudo nova-rootwrap %s' % CONF.rootwrap_config self.assertEqual(commands, [{'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('cat', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}]) + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}]) def test_has_file(self): global commands, files files = {} commands = [] - self.stubs.Set(utils, 'execute', fake_execute) + self.stubs.Set(processutils, 'execute', fake_execute) vfs = vfsimpl.VFSLocalFS(imgfile="/dummy.qcow2", imgfmt="qcow2") vfs.imgdir = "/scratch/dir" @@ -251,31 +269,38 @@ class VirtDiskVFSLocalFSTest(test.TestCase): self.assertTrue(vfs.has_file("/some/file")) self.assertFalse(vfs.has_file("/other/file")) + root_helper = 'sudo nova-rootwrap %s' % CONF.rootwrap_config self.assertEqual(commands, [{'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('cat', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('readlink', '-e', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('readlink', '-nm', '/scratch/dir/other/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('readlink', '-e', '/scratch/dir/other/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, ]) def test_set_permissions(self): global commands, files commands = [] files = {} - self.stubs.Set(utils, 'execute', fake_execute) + self.stubs.Set(processutils, 'execute', fake_execute) vfs = vfsimpl.VFSLocalFS(imgfile="/dummy.qcow2", imgfmt="qcow2") vfs.imgdir = "/scratch/dir" @@ -284,24 +309,29 @@ class VirtDiskVFSLocalFSTest(test.TestCase): vfs.set_permissions("/some/file", 0777) self.assertEquals(files["/scratch/dir/some/file"]["mode"], 0777) + root_helper = 'sudo nova-rootwrap %s' % CONF.rootwrap_config self.assertEqual(commands, [{'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('cat', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('chmod', '777', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}]) + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}]) def test_set_ownership(self): global commands, files commands = [] files = {} - self.stubs.Set(utils, 'execute', fake_execute) + self.stubs.Set(processutils, 'execute', fake_execute) vfs = vfsimpl.VFSLocalFS(imgfile="/dummy.qcow2", imgfmt="qcow2") vfs.imgdir = "/scratch/dir" @@ -322,27 +352,36 @@ class VirtDiskVFSLocalFSTest(test.TestCase): self.assertEquals(files["/scratch/dir/some/file"]["uid"], 110) self.assertEquals(files["/scratch/dir/some/file"]["gid"], 600) + root_helper = 'sudo nova-rootwrap %s' % CONF.rootwrap_config self.assertEqual(commands, [{'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('cat', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('chown', 'fred', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('chgrp', 'users', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('readlink', '-nm', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}, + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}, {'args': ('chown', 'joe:admins', '/scratch/dir/some/file'), - 'kwargs': {'run_as_root': True}}]) + 'kwargs': {'run_as_root': True, + 'root_helper': root_helper}}]) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 3490a5dbf..590bdbdaa 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -39,7 +39,7 @@ from nova.openstack.common import log as logging from nova import test from nova.tests.db import fakes as db_fakes from nova.tests import fake_network -from nova.tests import fake_utils +from nova.tests import fake_processutils import nova.tests.image.fake as fake_image from nova.tests import matchers from nova.tests.xenapi import stubs @@ -323,7 +323,7 @@ class XenAPIVMTestCase(stubs.XenAPITestBase): stubs.stubout_get_this_vm_uuid(self.stubs) stubs.stubout_is_vdi_pv(self.stubs) stubs.stub_out_vm_methods(self.stubs) - fake_utils.stub_out_utils_execute(self.stubs) + fake_processutils.stub_out_processutils_execute(self.stubs) self.user_id = 'fake' self.project_id = 'fake' self.context = context.RequestContext(self.user_id, self.project_id) @@ -872,7 +872,7 @@ class XenAPIVMTestCase(stubs.XenAPITestBase): def _readlink_handler(cmd_parts, **kwargs): return os.path.realpath(cmd_parts[2]), '' - fake_utils.fake_execute_set_repliers([ + fake_processutils.fake_execute_set_repliers([ # Capture the tee .../etc/network/interfaces command (r'tee.*interfaces', _tee_handler), (r'readlink -nm.*', _readlink_handler), @@ -917,7 +917,7 @@ class XenAPIVMTestCase(stubs.XenAPITestBase): self._tee_executed = True return '', '' - fake_utils.fake_execute_set_repliers([ + fake_processutils.fake_execute_set_repliers([ (r'mount', _mount_handler), (r'umount', _umount_handler), (r'tee.*interfaces', _tee_handler)]) @@ -1319,7 +1319,7 @@ class XenAPIMigrateInstance(stubs.XenAPITestBase): self.migration = db.migration_create( context.get_admin_context(), migration_values) - fake_utils.stub_out_utils_execute(self.stubs) + fake_processutils.stub_out_processutils_execute(self.stubs) stubs.stub_out_migration_methods(self.stubs) stubs.stubout_get_this_vm_uuid(self.stubs) -- cgit