Don't pass filter_properites to managers

Fixes bug 921789

distributed_scheduler is trying to pass filter_properties to compute
manager but it's not serializable.. and we shouldn't pass it anyway.

Change-Id: I17ce04b71dfa3cef77a6883ce3cd6fede95a538a
This commit is contained in:
Chris Behrens
2012-01-25 11:55:04 -08:00
parent ccfdd2d83d
commit b60e7c1433
2 changed files with 12 additions and 1 deletions

View File

@@ -98,6 +98,10 @@ class DistributedScheduler(driver.Scheduler):
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:
@@ -141,6 +145,10 @@ class DistributedScheduler(driver.Scheduler):
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)

View File

@@ -129,6 +129,8 @@ class DistributedSchedulerTestCase(test.TestCase):
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
@@ -152,7 +154,8 @@ class DistributedSchedulerTestCase(test.TestCase):
}
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)