From 4502d639989cb89bc9e6e830dae366ca300f5b60 Mon Sep 17 00:00:00 2001 From: Rongze Zhu Date: Sun, 19 Aug 2012 07:25:06 +0000 Subject: [PATCH] Remove stub_network flag Fixes bug #816025 remove stub_network flag and replace usage with stubbing out of relevant calls in tests. In nova/tests/fake_network.py , I add set_stub_network_methods and unset_stub_network_methods. They can be userd for tests. Change-Id: Ie8fa95d9ab62cced00f0917cffe75ebc6c94bb3e --- nova/flags.py | 3 --- nova/tests/test_volume_utils.py | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/nova/flags.py b/nova/flags.py index fd2fcc95..316e35e0 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -370,9 +370,6 @@ global_opts = [ default=False, help='Allow destination machine to match source for resize. ' 'Useful when testing in single-host environments.'), - cfg.BoolOpt('stub_network', - default=False, - help='Stub network related code'), cfg.IntOpt('reclaim_instance_interval', default=0, help='Interval in seconds for reclaiming deleted instances'), diff --git a/nova/tests/test_volume_utils.py b/nova/tests/test_volume_utils.py index cd81e67f..66b00d48 100644 --- a/nova/tests/test_volume_utils.py +++ b/nova/tests/test_volume_utils.py @@ -25,6 +25,7 @@ from nova.openstack.common import log as logging from nova.openstack.common.notifier import api as notifier_api from nova.openstack.common.notifier import test_notifier from nova import test +from nova.tests import fake_network from nova.volume import utils as volume_utils @@ -37,10 +38,11 @@ class UsageInfoTestCase(test.TestCase): def setUp(self): super(UsageInfoTestCase, self).setUp() self.flags(compute_driver='nova.virt.fake.FakeDriver', - stub_network=True, host='fake') self.stubs.Set(flags.FLAGS, 'notification_driver', ['nova.openstack.common.notifier.test_notifier']) + fake_network.set_stub_network_methods(self.stubs) + self.volume = importutils.import_object(FLAGS.volume_manager) self.user_id = 'fake' self.project_id = 'fake'