Skip to content

Commit

Permalink
Merge "Don't pass filter_properites to managers"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jan 26, 2012
2 parents 18f50f5 + 78910be commit 13dafc9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions nova/scheduler/distributed_scheduler.py
Expand Up @@ -98,6 +98,10 @@ def schedule_run_instance(self, context, request_spec, *args, **kwargs):
if not weighted_hosts:
raise exception.NoValidHost(reason=_(""))

# NOTE(comstud): Make sure we do not pass this through. It
# contains an instance of RpcContext that cannot be serialized.
kwargs.pop('filter_properties', None)

instances = []
for num in xrange(num_instances):
if not weighted_hosts:
Expand Down Expand Up @@ -141,6 +145,10 @@ def schedule_prep_resize(self, context, request_spec, *args, **kwargs):
raise exception.NoValidHost(reason=_(""))
host = hosts.pop(0)

# NOTE(comstud): Make sure we do not pass this through. It
# contains an instance of RpcContext that cannot be serialized.
kwargs.pop('filter_properties', None)

# Forward off to the host
driver.cast_to_compute_host(context, host.host_state.host,
'prep_resize', **kwargs)
Expand Down
5 changes: 4 additions & 1 deletion nova/tests/scheduler/test_distributed_scheduler.py
Expand Up @@ -129,6 +129,8 @@ def _fake_make_weighted_host_from_blob(*args, **kwargs):
return least_cost.WeightedHost(1, zone='x', blob='y')

def _fake_provision_resource_locally(*args, **kwargs):
# Tests that filter_properties is stripped
self.assertNotIn('filter_properties', kwargs)
self.locally_called = True
return 1

Expand All @@ -152,7 +154,8 @@ def _fake_ask_child_zone_to_create_instance(*args, **kwargs):
}

fake_context = context.RequestContext('user', 'project')
instances = sched.schedule_run_instance(fake_context, request_spec)
instances = sched.schedule_run_instance(fake_context, request_spec,
filter_properties={})
self.assertTrue(instances)
self.assertFalse(self.schedule_called)
self.assertTrue(self.from_blob_called)
Expand Down

0 comments on commit 13dafc9

Please sign in to comment.