diff --git a/nova/compute/manager.py b/nova/compute/manager.py index a38a3cba42bc..a74ba777689e 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -4531,7 +4531,7 @@ class ComputeManager(manager.SchedulerDependentManager): # Note(maoy): here we call the API instead of # brutally updating the vm_state in the database # to allow all the hooks and checks to be performed. - self.conductor_api.compute_stop(context, db_instance) + self.compute_api.stop(context, db_instance) except Exception: # Note(maoy): there is no need to propagate the error # because the same power_state will be retrieved next @@ -4544,7 +4544,7 @@ class ComputeManager(manager.SchedulerDependentManager): LOG.warn(_("Instance is suspended unexpectedly. Calling " "the stop API."), instance=db_instance) try: - self.conductor_api.compute_stop(context, db_instance) + self.compute_api.stop(context, db_instance) except Exception: LOG.exception(_("error during stop() in " "sync_power_state."), @@ -4574,7 +4574,7 @@ class ComputeManager(manager.SchedulerDependentManager): try: # Note(maoy): this assumes that the stop API is # idempotent. - self.conductor_api.compute_stop(context, db_instance) + self.compute_api.stop(context, db_instance) except Exception: LOG.exception(_("error during stop() in " "sync_power_state."), diff --git a/nova/conductor/api.py b/nova/conductor/api.py index d297512bcb16..0273866b8429 100644 --- a/nova/conductor/api.py +++ b/nova/conductor/api.py @@ -334,9 +334,6 @@ class LocalAPI(object): def get_ec2_ids(self, context, instance): return self._manager.get_ec2_ids(context, instance) - def compute_stop(self, context, instance, do_cast=True): - return self._manager.compute_stop(context, instance, do_cast) - def compute_confirm_resize(self, context, instance, migration_ref): return self._manager.compute_confirm_resize(context, instance, migration_ref) diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 2467a9096eb5..f504fc908548 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -519,6 +519,8 @@ class ConductorManager(manager.Manager): return ec2_ids + # NOTE(danms): This method is now deprecated and can be removed in + # version v2.0 of the RPC API def compute_stop(self, context, instance, do_cast=True): # NOTE(mriedem): Clients using an interface before 1.43 will be sending # dicts so we need to handle that here since compute/api::stop() diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py index be2ff6eae8d1..16b0a615dd31 100644 --- a/nova/conductor/rpcapi.py +++ b/nova/conductor/rpcapi.py @@ -479,16 +479,6 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy): msg = self.make_msg('get_ec2_ids', instance=instance_p) return self.call(context, msg, version='1.42') - def compute_stop(self, context, instance, do_cast=True): - if not self.can_send_version('1.55'): - instance = jsonutils.to_primitive( - objects_base.obj_to_primitive(instance)) - version = '1.43' - else: - version = '1.55' - msg = self.make_msg('compute_stop', instance=instance, do_cast=do_cast) - return self.call(context, msg, version=version) - def compute_confirm_resize(self, context, instance, migration_ref): migration_p = jsonutils.to_primitive(migration_ref) if not self.can_send_version('1.52'): diff --git a/nova/tests/compute/test_compute_mgr.py b/nova/tests/compute/test_compute_mgr.py index 2bc0054ea78f..b324a25bc41b 100644 --- a/nova/tests/compute/test_compute_mgr.py +++ b/nova/tests/compute/test_compute_mgr.py @@ -498,9 +498,9 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase): instance = self._get_sync_instance(power_state, vm_state) instance.refresh() instance.save() - self.mox.StubOutWithMock(self.compute.conductor_api, 'compute_stop') + self.mox.StubOutWithMock(self.compute.compute_api, 'stop') if stop: - self.compute.conductor_api.compute_stop(self.context, instance) + self.compute.compute_api.stop(self.context, instance) self.mox.ReplayAll() self.compute._sync_instance_power_state(self.context, instance, driver_power_state) diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index 1eb5be8a4551..8d9ceb7cbab0 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -594,12 +594,6 @@ class _BaseTestCase(object): result = self.conductor.get_ec2_ids(self.context, inst) self.assertEqual(result, expected) - def test_compute_stop(self): - self.mox.StubOutWithMock(self.conductor_manager.compute_api, 'stop') - self.conductor_manager.compute_api.stop(self.context, 'instance', True) - self.mox.ReplayAll() - self.conductor.compute_stop(self.context, 'instance') - def test_compute_confirm_resize(self): self.mox.StubOutWithMock(self.conductor_manager.compute_api, 'confirm_resize') @@ -819,16 +813,6 @@ class ConductorTestCase(_BaseTestCase, test.TestCase): self.conductor.security_groups_trigger_handler(self.context, 'event', ['args']) - def test_compute_stop_with_objects(self): - # use an instance object rather than a dict - instance = self._create_fake_instance() - inst_obj = instance_obj.Instance._from_db_object( - self.context, instance_obj.Instance(), instance) - self.mox.StubOutWithMock(self.conductor_manager.compute_api, 'stop') - self.conductor_manager.compute_api.stop(self.context, inst_obj, True) - self.mox.ReplayAll() - self.conductor.compute_stop(self.context, inst_obj) - def test_compute_confirm_resize_with_objects(self): # use an instance object rather than a dict instance = self._create_fake_instance()