From 188f306aa88a6a5b73959c74f1642720d7627789 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 12 Apr 2013 11:25:18 -0700 Subject: Make compute/manager use conductor for unrescue() The compute_api.unrescue() call makes direct database queries, which means it can't be called directly from compute manager. This patch adds support in conductor for proxying this request and makes compute manager utilize it. Fixes bug 1167619 Change-Id: I158c64cabdfe436462f5669047fb930819a13c50 --- nova/tests/compute/test_compute.py | 5 +++-- nova/tests/conductor/test_conductor.py | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 8ef7f9311..25fda928d 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -3732,12 +3732,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.""" -- cgit