From 959e65f320093a6b17945f52ad160da5aa042ff6 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 12 Feb 2013 12:34:39 -0500 Subject: Make compute manager use conductor for stopping instances During _sync_power_states, the manager will call to compute_api to stop instances as necessary. This takes a database hit, which isn't allowed. This directs that call through conductor, following the pattern of late. Fixes bug 1123219 Change-Id: I5d789dd73390cb1c41a245f6594b1c3aecf7efde --- nova/tests/conductor/test_conductor.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index 41554e79a..ed733599b 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -580,6 +580,12 @@ 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') + class ConductorTestCase(_BaseTestCase, test.TestCase): """Conductor Manager Tests.""" -- cgit