LeastCostScheduler wasn't checking for topic cost functions correctly.

Added support so that --least_cost_scheduler_cost_functions only needs to have method names specified, instead of the full blown version with module and class name.  Still works the old way, too.
This commit is contained in:
Chris Behrens
2011-06-23 23:38:32 -07:00
parent b07544045f
commit 25c3ae3534

View File

@@ -75,8 +75,15 @@ class LeastCostScheduler(zone_aware_scheduler.ZoneAwareScheduler):
cost_fns = []
for cost_fn_str in FLAGS.least_cost_scheduler_cost_functions:
if not cost_fn_str.startswith('%s_' % topic) and \
not cost_fn_str.startswith('noop'):
if '.' in cost_fn_str:
short_name = cost_fn_str.split('.')[-1]
else:
short_name = cost_fn_str
cost_fn_str = "%s.%s.%s" % (
__name__, self.__class__.__name__, short_name)
if not (short_name.startswith('%s_' % topic) or
short_name.startswith('noop')):
continue
try: