summaryrefslogtreecommitdiff
path: root/nova/filters.py
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2012-11-15 18:08:07 +0000
committerChris Behrens <cbehrens@codestud.com>2013-05-27 18:28:02 +0000
commit7a5ed3e76766596e45716d0fc05ff1e6e9199213 (patch)
treee10f8de59c7c3a6d6df8b40ccf9dae8736c020e4 /nova/filters.py
parent719ec4725eb7ae458810cbd2be0eb4a2cb5edf9d (diff)
downloadnova-7a5ed3e76766596e45716d0fc05ff1e6e9199213.tar.gz
Cells: Add filtering and weight support
This adds filtering and weighing support to the cells scheduler. Adds the following config options to the 'cells' group: scheduler_filter_classes -- list of filter classes scheduler_weight_classes -- list of weight classes Adds a couple of weighing modules as defaults (which removes the random cell selection): ram_by_instance_type: Select cells with the most capacity for the instance type being requested. weight_offset: Allows modifying the DB to weight a particular cell (useful for disabling a cell) Adds a filter class (TargetCellFilter) that allows specifying a scheduler hint to direct a build to a particular cell if you're an admin. DocImpact Implements blueprint cells-filter-scheduler Change-Id: I027c5734e3d6134127fcd4dd28b8ff39047416dc
Diffstat (limited to 'nova/filters.py')
-rw-r--r--nova/filters.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/nova/filters.py b/nova/filters.py
index 18e3a7d666..4b7f9ff102 100644
--- a/nova/filters.py
+++ b/nova/filters.py
@@ -54,8 +54,14 @@ class BaseFilterHandler(loadables.BaseLoader):
list_objs = list(objs)
LOG.debug("Starting with %d host(s)", len(list_objs))
for filter_cls in filter_classes:
- list_objs = list(filter_cls().filter_all(list_objs,
- filter_properties))
- LOG.debug("Filter %s returned %d host(s)",
- filter_cls.__name__, len(list_objs))
+ cls_name = filter_cls.__name__
+ objs = filter_cls().filter_all(list_objs,
+ filter_properties)
+ if objs is None:
+ LOG.debug("Filter %(cls_name)s says to stop filtering",
+ {'cls_name': cls_name})
+ return
+ list_objs = list(objs)
+ LOG.debug("Filter %(cls_name)s returned %(obj_len)d host(s)",
+ {'cls_name': cls_name, 'obj_len': len(list_objs)})
return list_objs