From 57154884c47143bfd6101d4b758d5e8d45966622 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 30 Jan 2013 18:22:45 -0500 Subject: Make scheduler modules pass conductor to add_instance_fault The add_instance_fault_from_exc() method was recently changed to take a conductor to avoid direct database access. The scheduler was not updated for this, and thus was not passing it in a couple of cases. This makes those calls pass a conductor LocalAPI, resulting in direct database access (which is desired from the scheduler). The tests that one might have thought would catch this didn't because they mock out the method itself. This fixes those and adds two tests that exercise the add_instance_fault path all the way down to the DB API, which would have caught it in the first place. Fixes bug 1110808 Change-Id: If1c2988487d408a39fdf4080541f58f6bdac216c --- nova/tests/scheduler/test_chance_scheduler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nova/tests/scheduler/test_chance_scheduler.py') diff --git a/nova/tests/scheduler/test_chance_scheduler.py b/nova/tests/scheduler/test_chance_scheduler.py index 76fba900d..dcbe86f75 100644 --- a/nova/tests/scheduler/test_chance_scheduler.py +++ b/nova/tests/scheduler/test_chance_scheduler.py @@ -25,6 +25,7 @@ import mox from nova.compute import rpcapi as compute_rpcapi from nova.compute import utils as compute_utils from nova.compute import vm_states +from nova.conductor import api as conductor_api from nova import context from nova import db from nova import exception @@ -134,7 +135,8 @@ class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase): {'vm_state': vm_states.ERROR, 'task_state': None}).AndReturn(({}, {})) compute_utils.add_instance_fault_from_exc(ctxt, - new_ref, mox.IsA(exception.NoValidHost), mox.IgnoreArg()) + mox.IsA(conductor_api.LocalAPI), new_ref, + mox.IsA(exception.NoValidHost), mox.IgnoreArg()) self.mox.ReplayAll() self.driver.schedule_run_instance( -- cgit