The Filter Scheduler supports filtering zun compute hosts to make decisions on where a new container should be created.
Filter Scheduler iterates over all found compute hosts,evaluating each host against a set of filters. The Scheduler then chooses a host for the requested container. A specific filter can decide whether to pass or filter out a specific host. The decision is made based on the user request specification, the state of the host, and/or some extra information.
If the Scheduler cannot find candidates for the container, it means that there are no appropriate host where that container can be scheduled.
The Filter Scheduler has a set of filters
that are built-in. If the
built-in filters is insufficient, you can implement your own filters with your
filtering algorithm.
There are many standard filter classes which may be used
(zun.scheduler.filters
):
To use filters you specify two settings:
filter_scheduler.available_filters
- Defines filter classes made
available to the scheduler.filter_scheduler.enabled_filters
- Of the available filters, defines
those that the scheduler uses by default.The default values for these settings in zun.conf are:
--filter_scheduler.available_filters=zun.scheduler.filters.all_filters
--filter_scheduler.enabled_filters=RamFilter,CPUFilter
With this configuration, all filters in zun.scheduler.filters
would be available, and by default the RamFilter and CPUFilter would be
used.
To create your own filter you must inherit from
BaseHostFilter and implement one method:
host_passes
. This method should return True
if the host passes the
filter.
P.S.: you can find more examples of using Filter Scheduler and standard filters
in zun.tests.scheduler
.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.