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
This commit is contained in:
Rongze Zhu
2012-08-19 07:25:06 +00:00
parent 7274993250
commit 4502d63998
2 changed files with 3 additions and 4 deletions

View File

@@ -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'),

View File

@@ -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'