From 3313cffde85a9f02d56f57b401c2aec5b91d6df8 Mon Sep 17 00:00:00 2001 From: Rongze Zhu Date: Sun, 19 Aug 2012 07:25:06 +0000 Subject: 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/compute/manager.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 6d499f9fb..98b2fafef 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -416,11 +416,7 @@ class ComputeManager(manager.SchedulerDependentManager): return self.driver.refresh_provider_fw_rules(**kwargs) def _get_instance_nw_info(self, context, instance): - """Get a list of dictionaries of network data of an instance. - Returns an empty list if stub_network flag is set.""" - if FLAGS.stub_network: - return network_model.NetworkInfo() - + """Get a list of dictionaries of network data of an instance.""" # get the network info from network network_info = self.network_api.get_instance_nw_info(context, instance) @@ -722,10 +718,6 @@ class ComputeManager(manager.SchedulerDependentManager): def _allocate_network(self, context, instance, requested_networks): """Allocate networks for an instance and return the network info""" - if FLAGS.stub_network: - LOG.debug(_('Skipping network allocation for instance'), - instance=instance) - return network_model.NetworkInfo() self._instance_update(context, instance['uuid'], vm_state=vm_states.BUILDING, task_state=task_states.NETWORKING) @@ -792,10 +784,8 @@ class ComputeManager(manager.SchedulerDependentManager): extra_usage_info=extra_usage_info, host=self.host) def _deallocate_network(self, context, instance): - if not FLAGS.stub_network: - LOG.debug(_('Deallocating network for instance'), - instance=instance) - self.network_api.deallocate_for_instance(context, instance) + LOG.debug(_('Deallocating network for instance'), instance=instance) + self.network_api.deallocate_for_instance(context, instance) def _get_instance_volume_bdms(self, context, instance_uuid): bdms = self.db.block_device_mapping_get_all_by_instance(context, -- cgit