Scheduler

Scheduler

The manila.scheduler.manager Module

The manila.scheduler.base_handler Module

A common base for handling extension classes.

Used by BaseFilterHandler and BaseWeightHandler

class BaseHandler(modifier_class_type, modifier_namespace)

Bases: object

Base class to handle loading filter and weight classes.

get_all_classes()

The manila.scheduler.host_manager Module

The manila.scheduler.rpcapi Module

The manila.scheduler.scheduler_options Module

SchedulerOptions monitors a local .json file for changes and loads it if needed. This file is converted to a data structure and passed into the filtering and weighing functions which can use it for dynamic configuration.

class SchedulerOptions

Bases: object

Monitor and load local .json file for filtering and weighing.

SchedulerOptions monitors a local .json file for changes and loads it if needed. This file is converted to a data structure and passed into the filtering and weighing functions which can use it for dynamic configuration.

get_configuration(filename=None)

Check the json file for changes and load it if needed.

The manila.scheduler.drivers.filter Module

The manila.scheduler.drivers.base Module

The manila.scheduler.drivers.chance Module

The manila.scheduler.drivers.simple Module

Scheduler Filters

The manila.scheduler.filters.availability_zone Filter

class AvailabilityZoneFilter

Bases: manila.scheduler.filters.base_host.BaseHostFilter

Filters Hosts by availability zone.

host_passes(host_state, filter_properties)
run_filter_once_per_request = True

The manila.scheduler.filters.base Filter

Filter support

class BaseFilter

Bases: object

Base class for all filter classes.

filter_all(filter_obj_list, filter_properties)

Yield objects that pass the filter.

Can be overridden in a subclass, if you need to base filtering decisions on all objects. Otherwise, one can just override _filter_one() to filter a single object.

run_filter_for_index(index)

Check if filter needs to be run for the “index-th” instance.

Return True if the filter needs to be run for the “index-th” instance in a request. Only need to override this if a filter needs anything other than “first only” or “all” behaviour.

run_filter_once_per_request = False
class BaseFilterHandler(modifier_class_type, modifier_namespace)

Bases: manila.scheduler.base_handler.BaseHandler

Base class to handle loading filter classes.

This class should be subclassed where one needs to use filters.

get_filtered_objects(filter_classes, objs, filter_properties, index=0)

Get objects after filter

Parameters:
  • filter_classes – filters that will be used to filter the objects
  • objs – objects that will be filtered
  • filter_properties – client filter properties
  • index – This value needs to be increased in the caller function of get_filtered_objects when handling each resource.

The manila.scheduler.filters.base_host Filter

Scheduler host filters

class BaseHostFilter

Bases: manila.scheduler.filters.base.BaseFilter

Base class for host filters.

host_passes(host_state, filter_properties)

Return True if the HostState passes the filter, otherwise False.

Override this in a subclass.

class HostFilterHandler(namespace)

Bases: manila.scheduler.filters.base.BaseFilterHandler

The manila.scheduler.filters.capabilities Filter

class CapabilitiesFilter

Bases: manila.scheduler.filters.base_host.BaseHostFilter

HostFilter to work with resource (instance & volume) type records.

host_passes(host_state, filter_properties)

Return a list of hosts that can create resource_type.

The manila.scheduler.filters.capacity Filter

class CapacityFilter

Bases: manila.scheduler.filters.base_host.BaseHostFilter

CapacityFilter filters based on share host’s capacity utilization.

host_passes(host_state, filter_properties)

Return True if host has sufficient capacity.

The manila.scheduler.filters.extra_specs_ops Filter

match(value, req)

The manila.scheduler.filters.ignore_attempted_hosts Filter

class IgnoreAttemptedHostsFilter

Bases: manila.scheduler.filters.base_host.BaseHostFilter

Filter out previously attempted hosts

A host passes this filter if it has not already been attempted for scheduling. The scheduler needs to add previously attempted hosts to the ‘retry’ key of filter_properties in order for this to work correctly. For example:

{
 'retry': {
           'hosts': ['host1', 'host2'],
           'num_attempts': 3,
          }
}
host_passes(host_state, filter_properties)

Skip nodes that have already been attempted.

The manila.scheduler.filters.json Filter

class JsonFilter

Bases: manila.scheduler.filters.base_host.BaseHostFilter

Host Filter to allow simple JSON-based grammar for selecting hosts.

commands = {'<': <function _less_than at 0x7fd4999f6a28>, '<=': <function _less_than_equal at 0x7fd4999f6b90>, '=': <function _equals at 0x7fd4999f69b0>, '>': <function _greater_than at 0x7fd4999f6aa0>, '>=': <function _greater_than_equal at 0x7fd4999f6c08>, 'and': <function _and at 0x7fd4999f6d70>, 'in': <function _in at 0x7fd4999f6b18>, 'not': <function _not at 0x7fd4999f6c80>, 'or': <function _or at 0x7fd4999f6cf8>}
host_passes(host_state, filter_properties)

Filters hosts.

Return a list of hosts that can fulfill the requirements specified in the query.

The manila.scheduler.filters.retry Filter

class RetryFilter

Bases: manila.scheduler.filters.base_host.BaseHostFilter

Filter out already tried nodes for scheduling purposes.

host_passes(host_state, filter_properties)

Skip nodes that have already been attempted.

The manila.scheduler.filters.share_replication Filter

class ShareReplicationFilter

Bases: manila.scheduler.filters.base_host.BaseHostFilter

ShareReplicationFilter filters hosts based on replication support.

host_passes(host_state, filter_properties)

Return True if ‘active’ replica’s host can replicate with host.

Design of this filter:

  • Share replication is symmetric. All backends that can replicate between each other must share the same ‘replication_domain’.
  • For scheduling a share that can be replicated in the future, this filter checks for ‘replication_domain’ capability.
  • For scheduling a replica, it checks for the ‘replication_domain’ compatibility.

Scheduler Weighers

The manila.scheduler.weighers.base Weigher

Pluggable Weighing support

class BaseWeigher

Bases: object

Base class for pluggable weighers.

The attributes maxval and minval can be specified to set up the maximum and minimum values for the weighed objects. These values will then be taken into account in the normalization step, instead of taking the values from the calculated weighers.

maxval = None
minval = None
weigh_objects(weighed_obj_list, weight_properties)

Weigh multiple objects.

Override in a subclass if you need access to all objects in order to calculate weighers. Do not modify the weight of an object here, just return a list of weighers.

weight_multiplier()

How weighted this weigher should be.

Override this method in a subclass, so that the returned value is read from a configuration option to permit operators specify a multiplier for the weigher.

class BaseWeightHandler(modifier_class_type, modifier_namespace)

Bases: manila.scheduler.base_handler.BaseHandler

get_weighed_objects(weigher_classes, obj_list, weighing_properties)

Return a sorted (descending), normalized list of WeighedObjects.

object_class

alias of WeighedObject

class WeighedObject(obj, weight)

Bases: object

Object with weight information.

normalize(weight_list, minval=None, maxval=None)

Normalize the values in a list between 0 and 1.0.

The normalization is made regarding the lower and upper values present in weight_list. If the minval and/or maxval parameters are set, these values will be used instead of the minimum and maximum from the list.

If all the values are equal, they are normalized to 0.

The manila.scheduler.weighers.base_host Weigher

Scheduler host weighers

class BaseHostWeigher

Bases: manila.scheduler.weighers.base.BaseWeigher

Base class for host weighers.

class HostWeightHandler(namespace)

Bases: manila.scheduler.weighers.base.BaseWeightHandler

object_class

alias of WeighedHost

class WeighedHost(obj, weight)

Bases: manila.scheduler.weighers.base.WeighedObject

to_dict()

The manila.scheduler.weighers.capacity Weigher

Capacity Weigher. Weigh hosts by their virtual or actual free capacity.

For thin provisioning, weigh hosts by their virtual free capacity calculated by the total capacity multiplied by the max over subscription ratio and subtracting the provisioned capacity; Otherwise, weigh hosts by their actual free capacity, taking into account the reserved space.

The default is to spread shares across all hosts evenly. If you prefer stacking, you can set the ‘capacity_weight_multiplier’ option to a negative number and the weighing has the opposite effect of the default.

class CapacityWeigher

Bases: manila.scheduler.weighers.base_host.BaseHostWeigher

weigh_objects(weighed_obj_list, weight_properties)
weight_multiplier()

Override the weight multiplier.

The manila.scheduler.weighers.pool Weigher

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.