diff options
author | Jenkins <jenkins@review.openstack.org> | 2012-10-29 00:28:42 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2012-10-29 00:28:42 +0000 |
commit | d1f6cb8b51f7fd7dd4208aca8e39eaaadbb90956 (patch) | |
tree | 37e9239404d25f6de7082d6f88316f10ea6f92c0 /nova | |
parent | fe8685cc2646d2f947a890f2013220995c78fa10 (diff) | |
parent | 7137280f4bc62f70c0a1eb838488a2864d08e3f2 (diff) | |
download | nova-d1f6cb8b51f7fd7dd4208aca8e39eaaadbb90956.tar.gz nova-d1f6cb8b51f7fd7dd4208aca8e39eaaadbb90956.tar.xz nova-d1f6cb8b51f7fd7dd4208aca8e39eaaadbb90956.zip |
Merge "Don't elevate context when calling run_instance"
Diffstat (limited to 'nova')
-rw-r--r-- | nova/scheduler/filter_scheduler.py | 3 | ||||
-rw-r--r-- | nova/tests/scheduler/test_filter_scheduler.py | 15 |
2 files changed, 6 insertions, 12 deletions
diff --git a/nova/scheduler/filter_scheduler.py b/nova/scheduler/filter_scheduler.py index 789f252b0..51f07e1bb 100644 --- a/nova/scheduler/filter_scheduler.py +++ b/nova/scheduler/filter_scheduler.py @@ -59,7 +59,6 @@ class FilterScheduler(driver.Scheduler): Returns a list of the instances created. """ - elevated = context.elevated() instance_uuids = request_spec.get('instance_uuids') num_instances = len(instance_uuids) LOG.debug(_("Attempting to build %(num_instances)d instance(s)") % @@ -86,7 +85,7 @@ class FilterScheduler(driver.Scheduler): except IndexError: raise exception.NoValidHost(reason="") - self._provision_resource(elevated, weighted_host, + self._provision_resource(context, weighted_host, request_spec, filter_properties, requested_networks, diff --git a/nova/tests/scheduler/test_filter_scheduler.py b/nova/tests/scheduler/test_filter_scheduler.py index aeb4c6dfd..394b9b67f 100644 --- a/nova/tests/scheduler/test_filter_scheduler.py +++ b/nova/tests/scheduler/test_filter_scheduler.py @@ -105,7 +105,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase): "foo", {}, {}) def test_scheduler_includes_launch_index(self): - ctxt = "fake-context" + fake_context = context.RequestContext('user', 'project') fake_kwargs = {'fake_kwarg1': 'fake_value1', 'fake_kwarg2': 'fake_value2'} instance_opts = {'fake_opt1': 'meow'} @@ -125,32 +125,27 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase): return False return _check_launch_index - class ContextFake(object): - def elevated(self): - return ctxt - context_fake = ContextFake() - self.mox.StubOutWithMock(self.driver, '_schedule') self.mox.StubOutWithMock(self.driver, '_provision_resource') - self.driver._schedule(context_fake, 'compute', + self.driver._schedule(fake_context, 'compute', request_spec, {}, ['fake-uuid1', 'fake-uuid2'] ).AndReturn(['host1', 'host2']) # instance 1 self.driver._provision_resource( - ctxt, 'host1', + fake_context, 'host1', mox.Func(_has_launch_index(0)), {}, None, None, None, None, instance_uuid='fake-uuid1').AndReturn(instance1) # instance 2 self.driver._provision_resource( - ctxt, 'host2', + fake_context, 'host2', mox.Func(_has_launch_index(1)), {}, None, None, None, None, instance_uuid='fake-uuid2').AndReturn(instance2) self.mox.ReplayAll() - self.driver.schedule_run_instance(context_fake, request_spec, + self.driver.schedule_run_instance(fake_context, request_spec, None, None, None, None, {}) def test_schedule_happy_day(self): |