summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2011-06-23 23:38:32 -0700
committerChris Behrens <cbehrens@codestud.com>2011-06-23 23:38:32 -0700
commit4307daa9848060aad4b714394f314e5b6e823208 (patch)
tree8248ac0825764542a44c7bcb790ddd9e7805be14
parent108314eac2f3c91be68c525902ce31e3abab4ecd (diff)
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.
-rw-r--r--nova/scheduler/least_cost.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/nova/scheduler/least_cost.py b/nova/scheduler/least_cost.py
index 9376631ef..6f5eb66fd 100644
--- a/nova/scheduler/least_cost.py
+++ b/nova/scheduler/least_cost.py
@@ -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: