diff options
-rw-r--r-- | nova/compute/api.py | 3 | ||||
-rw-r--r-- | nova/compute/manager.py | 9 | ||||
-rw-r--r-- | nova/compute/rpcapi.py | 8 | ||||
-rw-r--r-- | nova/tests/compute/test_compute.py | 12 | ||||
-rw-r--r-- | nova/tests/compute/test_rpcapi.py | 3 |
5 files changed, 11 insertions, 24 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index bddb83449..65e33ff06 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1547,12 +1547,9 @@ class API(base.Base): elevated = context.elevated() block_info = self._get_block_device_info(elevated, instance['uuid']) - network_info = self.network_api.get_instance_nw_info(elevated, - instance) self.compute_rpcapi.reboot_instance(context, instance=instance, block_device_info=block_info, - network_info=network_info, reboot_type=reboot_type) def _get_image(self, context, image_href): diff --git a/nova/compute/manager.py b/nova/compute/manager.py index e1bbc1df6..3bf8e61ef 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -293,7 +293,7 @@ class ComputeVirtAPI(virtapi.VirtAPI): class ComputeManager(manager.SchedulerDependentManager): """Manages the running instances from creation to destruction.""" - RPC_API_VERSION = '2.22' + RPC_API_VERSION = '2.23' def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" @@ -1440,12 +1440,7 @@ class ComputeManager(manager.SchedulerDependentManager): if block_device_info is None: block_device_info = self._get_instance_volume_block_device_info( context, instance) - # NOTE(danms): remove this when RPC API < 2.5 compatibility - # is no longer needed - if network_info is None: - network_info = self._get_instance_nw_info(context, instance) - else: - network_info = network_model.NetworkInfo.hydrate(network_info) + network_info = self._get_instance_nw_info(context, instance) self._notify_about_instance_usage(context, instance, "reboot.start") diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 1c53b6084..3e7ed1cfd 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -157,6 +157,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): 2.21 - Add migrate_data dict param to pre_live_migration() 2.22 - Add recreate, on_shared_storage and host arguments to rebuild_instance() + 2.23 - Remove network_info from reboot_instance ''' # @@ -383,16 +384,15 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): _compute_topic(self.topic, ctxt, host, None), version='2.20') - def reboot_instance(self, ctxt, instance, - block_device_info, network_info, reboot_type): + def reboot_instance(self, ctxt, instance, block_device_info, + reboot_type): instance_p = jsonutils.to_primitive(instance) self.cast(ctxt, self.make_msg('reboot_instance', instance=instance_p, block_device_info=block_device_info, - network_info=network_info, reboot_type=reboot_type), topic=_compute_topic(self.topic, ctxt, None, instance), - version='2.5') + version='2.23') def rebuild_instance(self, ctxt, instance, new_pass, injected_files, image_ref, orig_image_ref, orig_sys_metadata, bdms, diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index d3d0e5d45..0c14fb891 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -1000,8 +1000,7 @@ class ComputeTestCase(BaseTestCase): # This is a true unit test, so we don't need the network stubs. fake_network.unset_stub_network_methods(self.stubs) - self.mox.StubOutWithMock(network_model.NetworkInfo, - 'hydrate') + self.mox.StubOutWithMock(self.compute, '_get_instance_nw_info') self.mox.StubOutWithMock(self.compute, '_notify_about_instance_usage') self.mox.StubOutWithMock(self.compute, '_instance_update') self.mox.StubOutWithMock(self.compute, '_get_power_state') @@ -1015,7 +1014,6 @@ class ComputeTestCase(BaseTestCase): updated_instance2 = dict(uuid='updated-instance2', power_state='fake') - fake_nw_info = 'fake-network-info' fake_nw_model = network_model.NetworkInfo() self.mox.StubOutWithMock(fake_nw_model, 'legacy') @@ -1035,8 +1033,9 @@ class ComputeTestCase(BaseTestCase): self.mox.StubOutWithMock(self.context, 'elevated') self.context.elevated().AndReturn(econtext) - network_model.NetworkInfo.hydrate(fake_nw_info).AndReturn( - fake_nw_model) + self.compute._get_instance_nw_info(econtext, + instance).AndReturn( + fake_nw_model) self.compute._notify_about_instance_usage(econtext, instance, 'reboot.start') @@ -1086,7 +1085,6 @@ class ComputeTestCase(BaseTestCase): self.mox.ReplayAll() self.compute.reboot_instance(self.context, instance=instance, block_device_info=fake_block_dev_info, - network_info=fake_nw_info, reboot_type=reboot_type) self.assertEqual(expected_call_info, reboot_call_info) @@ -4237,12 +4235,10 @@ class ComputeAPITestCase(BaseTestCase): def _stub_out_reboot(self, device_name): def fake_reboot_instance(rpcapi, context, instance, block_device_info, - network_info, reboot_type): self.assertEqual( block_device_info['block_device_mapping'][0]['mount_device'], device_name) - self.assertEqual(network_info[0]['network']['bridge'], 'fake_br1') self.stubs.Set(nova.compute.rpcapi.ComputeAPI, 'reboot_instance', fake_reboot_instance) diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py index a31d9a14b..00b90ea65 100644 --- a/nova/tests/compute/test_rpcapi.py +++ b/nova/tests/compute/test_rpcapi.py @@ -236,9 +236,8 @@ class ComputeRpcAPITestCase(test.TestCase): self._test_compute_api('reboot_instance', 'cast', instance=self.fake_instance, block_device_info={}, - network_info={}, reboot_type='type', - version='2.5') + version='2.23') def test_rebuild_instance(self): self._test_compute_api('rebuild_instance', 'cast', |