diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-04-14 04:03:12 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-04-14 04:03:12 +0000 |
| commit | 497b42372d820bb9bf2c9dfd482e5abf9ef1f940 (patch) | |
| tree | 503ee6c8e368e6b4bf3dcbd84132ffbabe2481be | |
| parent | 059a05d6cc241ad38a0204d8782b7debf4e823d2 (diff) | |
| parent | 188f306aa88a6a5b73959c74f1642720d7627789 (diff) | |
| download | nova-497b42372d820bb9bf2c9dfd482e5abf9ef1f940.tar.gz nova-497b42372d820bb9bf2c9dfd482e5abf9ef1f940.tar.xz nova-497b42372d820bb9bf2c9dfd482e5abf9ef1f940.zip | |
Merge "Make compute/manager use conductor for unrescue()"
| -rwxr-xr-x | nova/compute/manager.py | 2 | ||||
| -rw-r--r-- | nova/conductor/api.py | 6 | ||||
| -rw-r--r-- | nova/conductor/manager.py | 5 | ||||
| -rw-r--r-- | nova/conductor/rpcapi.py | 6 | ||||
| -rw-r--r-- | nova/tests/compute/test_compute.py | 5 | ||||
| -rw-r--r-- | nova/tests/conductor/test_conductor.py | 7 |
6 files changed, 27 insertions, 4 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 87338f494..9c11ce1f7 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -3482,7 +3482,7 @@ class ComputeManager(manager.SchedulerDependentManager): to_unrescue.append(instance) for instance in to_unrescue: - self.compute_api.unrescue(context, instance) + self.conductor_api.compute_unrescue(context, instance) @manager.periodic_task def _poll_unconfirmed_resizes(self, context): diff --git a/nova/conductor/api.py b/nova/conductor/api.py index a0b94b549..c7e824df4 100644 --- a/nova/conductor/api.py +++ b/nova/conductor/api.py @@ -344,6 +344,9 @@ class LocalAPI(object): return self._manager.compute_confirm_resize(context, instance, migration_ref) + def compute_unrescue(self, context, instance): + return self._manager.compute_unrescue(context, instance) + class API(object): """Conductor API that does updates via RPC to the ConductorManager.""" @@ -683,3 +686,6 @@ class API(object): return self.conductor_rpcapi.compute_confirm_resize(context, instance, migration_ref) + + def compute_unrescue(self, context, instance): + return self.conductor_rpcapi.compute_unrescue(context, instance) diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index f557a0c67..604d2ab4b 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -49,7 +49,7 @@ datetime_fields = ['launched_at', 'terminated_at', 'updated_at'] class ConductorManager(manager.Manager): """Mission: TBD.""" - RPC_API_VERSION = '1.47' + RPC_API_VERSION = '1.48' def __init__(self, *args, **kwargs): super(ConductorManager, self).__init__(*args, **kwargs) @@ -429,3 +429,6 @@ class ConductorManager(manager.Manager): def compute_confirm_resize(self, context, instance, migration_ref): self.compute_api.confirm_resize(context, instance, migration_ref) + + def compute_unrescue(self, context, instance): + self.compute_api.unrescue(context, instance) diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py index 2f6dbcc43..adfe752ca 100644 --- a/nova/conductor/rpcapi.py +++ b/nova/conductor/rpcapi.py @@ -86,6 +86,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.46 - Added compute_confirm_resize 1.47 - Added columns_to_join to instance_get_all_by_host and instance_get_all_by_filters + 1.48 - Added compute_unrescue """ BASE_RPC_API_VERSION = '1.0' @@ -449,3 +450,8 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy): msg = self.make_msg('compute_confirm_resize', instance=instance_p, migration_ref=migration_p) return self.call(context, msg, version='1.46') + + def compute_unrescue(self, context, instance): + instance_p = jsonutils.to_primitive(instance) + msg = self.make_msg('compute_unrescue', instance=instance_p) + return self.call(context, msg, version='1.48') diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 11c4da4a6..88434078d 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -3766,12 +3766,13 @@ class ComputeTestCase(BaseTestCase): self.assertEqual(columns_to_join, []) return instances - def fake_unrescue(self, context, instance): + def fake_unrescue(context, instance): unrescued_instances[instance['uuid']] = True self.stubs.Set(self.compute.conductor_api, 'instance_get_all_by_host', fake_instance_get_all_by_host) - self.stubs.Set(compute_api.API, 'unrescue', fake_unrescue) + self.stubs.Set(self.compute.conductor_api, 'compute_unrescue', + fake_unrescue) self.flags(rescue_timeout=60) ctxt = context.get_admin_context() diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index e339ecf44..fee919a33 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -612,6 +612,13 @@ class _BaseTestCase(object): self.conductor.compute_confirm_resize(self.context, 'instance', 'migration') + def test_compute_unrescue(self): + self.mox.StubOutWithMock(self.conductor_manager.compute_api, + 'unrescue') + self.conductor_manager.compute_api.unrescue(self.context, 'instance') + self.mox.ReplayAll() + self.conductor.compute_unrescue(self.context, 'instance') + class ConductorTestCase(_BaseTestCase, test.TestCase): """Conductor Manager Tests.""" |
