]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Implement filter scheduler
authorZhiteng Huang <zhiteng.huang@intel.com>
Fri, 5 Oct 2012 16:08:09 +0000 (00:08 +0800)
committerZhiteng Huang <zhiteng.huang@intel.com>
Thu, 10 Jan 2013 03:22:56 +0000 (11:22 +0800)
commit643f9169c4aae46f8c2ce0b8ad725c55946a4afd
tree8b1060508e7b299bb09a9a0c0d59f6440cae0c4c
parent9e3a254f6d94a42b23f9f2dec85d6db5e19d380a
Implement filter scheduler

In order to do more sophisticated scheduling (e.g. schedule based on volume
type), filter scheduler is introduced. Several changes are made to make this
possible, some of them are similar to the counterpart in Nova:

- add HostState class to host_manager in order to store volume capabilities
- implement get_volume_stats() method of iSCSIDriver as an example to
demonstrate how volume backend driver reports capabilities as well as status
- add scheduler_options.py and 'scheduler_json_config_location' flag to be
allow loading json configuration file for scheduler at run time
- port common filters/weights from oslo
- add capacity weigher (scheduler/weights/capacity.py) for picking up
target volume backend by weighing free capacity of the host. The default
behavior is to spread volumes across hosts; by changing the
'capacity_weight_multiplier' to negative number, volume placing behavior will
become stacking.
- add capacity filter which filters those hosts have insufficient storage space
to serve the request.
- add 'reserved_percentage' config option to indicate how much space is
reserved. Capacity reservation is needed when volume resize is enabled.
- add 'publish_service_capabilities()' method to volume RPC API to allow
scheduler to have volume service report capabilities. This bumps volume RPC
API to version 1.2
- remove 'volume_force_update_capabilities' config option, volume status will be
report to scheduler in every checking.

The implication of this change to storage/backend driver developer:
- implementation of get_volume_stats() of the driver is now a *MUST*, filter
scheduler heavily relies on the status/capabilities reported by backend driver
to makeplacement decision.  To ensure Cinder works seamlessly on the storage
system, driver should at least report following capabilities/status:
----------------------+---------------------------+---------------------------
  Capability/Status   |      Description          |         Example
----------------------+---------------------------+---------------------------
 'volume_backend_name'| back-end name, string     | 'Example_Storage_Backend'
----------------------+---------------------------+---------------------------
  'vendor_name'       | vendor name, string       | 'OpenStackCinder'
----------------------+---------------------------+---------------------------
  'driver_version'    | version, string           |  '1.0a'
----------------------+---------------------------+---------------------------
  'storage_protocol'  | supported protocols,      | 'iSCSI', 'RBD', 'FC', 'NFS'
                      | string or list of strings | ['iSCSI', 'NFS', 'FC']
----------------------+---------------------------+---------------------------
  'total_capacity_gb' | capacity in GB, integer   |  102400
----------------------+---------------------------+---------------------------
  'free_capacity_gb'  | available capacity in GB, |  1000
                      | integer                   |
----------------------+---------------------------+---------------------------
'reserved_percentage' | reserved space in         |  0, 10
                      | percentage, integer       |
----------------------+---------------------------+---------------------------

The implication of this change to Cinder administrator:
- the default setting for filter scheduler should work well with the benefits
of:
  * being able to fully utilize capacity of backends (driver now has to report
  actul total space and space utilization and scheduler uses these info) not
  limited by the 'max_gigabytes' config option any more;
  * being able to choose placement policy between spreading & stacking for
  volume creation (by modifying the 'capacity_weight_multiplier' in
  CapacityWeigher)
- with filter scheduler, Cinder is now able to utilize the advanced features/
capabilities provided by different storage back-ends via: defining different
volume types with proper extra_specs. Volume types can be considered as sets
of back-end capabilities requirement.
 For example, a volume type which has 'storage_protocol':'FC' key/value pair
definition in its extra_spec can only be served by those back-ends who report
they support FiberChannel protocol. Another example is volume type has 'QoS'
requirement can only be served by back-ends support QoS.

Note/TODO:
* Currently scheduler makes its decision based on the status and capabilities
information reported by volume nodes, and these information is stored in memory
of scheduler process. More sophisticated way may be add on table in DB to
record status/capabilities of all volume nodes, like Nova does for compute nodes.

implement bp volume-type-scheduler

DocImpact

Change-Id: I296b3727db8de0d4cf085fac602d122a7b474842
30 files changed:
cinder/exception.py
cinder/openstack/common/scheduler/__init__.py [new file with mode: 0644]
cinder/openstack/common/scheduler/filter.py [new file with mode: 0644]
cinder/openstack/common/scheduler/filters/__init__.py [new file with mode: 0644]
cinder/openstack/common/scheduler/filters/availability_zone_filter.py [new file with mode: 0644]
cinder/openstack/common/scheduler/filters/capabilities_filter.py [new file with mode: 0644]
cinder/openstack/common/scheduler/filters/extra_specs_ops.py [new file with mode: 0644]
cinder/openstack/common/scheduler/filters/json_filter.py [new file with mode: 0644]
cinder/openstack/common/scheduler/weight.py [new file with mode: 0644]
cinder/openstack/common/scheduler/weights/__init__.py [new file with mode: 0644]
cinder/scheduler/filter_scheduler.py [new file with mode: 0644]
cinder/scheduler/filters/__init__.py [new file with mode: 0644]
cinder/scheduler/filters/capacity_filter.py [new file with mode: 0644]
cinder/scheduler/host_manager.py
cinder/scheduler/manager.py
cinder/scheduler/scheduler_options.py [new file with mode: 0644]
cinder/scheduler/weights/__init__.py [new file with mode: 0644]
cinder/scheduler/weights/capacity.py [new file with mode: 0644]
cinder/tests/scheduler/fakes.py
cinder/tests/scheduler/test_capacity_weigher.py [new file with mode: 0644]
cinder/tests/scheduler/test_filter_scheduler.py [new file with mode: 0644]
cinder/tests/scheduler/test_host_filters.py [new file with mode: 0644]
cinder/tests/scheduler/test_host_manager.py [new file with mode: 0644]
cinder/tests/scheduler/test_scheduler_options.py [new file with mode: 0644]
cinder/volume/driver.py
cinder/volume/manager.py
cinder/volume/rpcapi.py
openstack-common.conf
setup.py
tools/pip-requires