Scheduler

The cinder.scheduler.manager Module

Scheduler Service

class SchedulerManager(scheduler_driver=None, service_name=None, *args, **kwargs)

Bases: cinder.manager.CleanableManager, cinder.manager.Manager

Chooses a host to create volumes.

RPC_API_VERSION = '3.5'
create_consistencygroup(context, group, request_spec_list=None, filter_properties_list=None)
create_group(context, group, group_spec=None, group_filter_properties=None, request_spec_list=None, filter_properties_list=None)
create_volume(context, volume, snapshot_id=None, image_id=None, request_spec=None, filter_properties=None)
extend_volume(context, volume, new_size, reservations, request_spec=None, filter_properties=None)
get_pools(context, filters=None)

Get active pools from scheduler’s cache.

NOTE(dulek): There’s no self._wait_for_scheduler() because get_pools is an RPC call (is blocking for the c-api). Also this is admin-only API extension so it won’t hurt the user much to retry the request manually.

init_host_with_rpc()
manage_existing(context, volume, request_spec, filter_properties=None)

Ensure that the host exists and can accept the volume.

migrate_volume(context, volume, backend, force_copy, request_spec, filter_properties)

Ensure that the backend exists and can accept the volume.

migrate_volume_to_host(context, volume, host, force_host_copy, request_spec, filter_properties=None)
notify_service_capabilities(context, service_name, capabilities, host=None, backend=None, timestamp=None)

Process a capability update from a service node.

request_service_capabilities(context)
reset()
retype(context, volume, request_spec, filter_properties=None)

Schedule the modification of a volume’s type.

Parameters:
  • context – the request context
  • volume – the volume object to retype
  • request_spec – parameters for this retype request
  • filter_properties – parameters to filter by
target = <Target version=3.5>
update_service_capabilities(context, service_name=None, host=None, capabilities=None, cluster_name=None, timestamp=None, **kwargs)

Process a capability update from a service node.

upgrading_cloud
work_cleanup(context, cleanup_request)

Process request from API to do cleanup on services.

Here we retrieve from the DB which services we want to clean up based on the request from the user.

Then send individual cleanup requests to each of the services that are up, and we finally return a tuple with services that we have sent a cleanup request and those that were not up and we couldn’t send it.

The cinder.scheduler.driver Module

Scheduler base class that all Schedulers should inherit from

class Scheduler

Bases: object

The base class that all Scheduler classes should inherit from.

backend_passes_filters(context, backend, request_spec, filter_properties)

Check if the specified backend passes the filters.

find_retype_backend(context, request_spec, filter_properties=None, migration_policy='never')

Find a backend that can accept the volume with its new type.

find_retype_host(context, request_spec, filter_properties=None, migration_policy='never')

Find a backend that can accept the volume with its new type.

get_pools(context, filters)

Must override schedule method for scheduler to work.

host_passes_filters(context, backend, request_spec, filter_properties)

Check if the specified backend passes the filters.

is_ready()

Returns True if Scheduler is ready to accept requests.

This is to handle scheduler service startup when it has no volume hosts stats and will fail all the requests.

notify_service_capabilities(service_name, backend, capabilities, timestamp)

Notify capability update from a service node.

reset()

Reset volume RPC API object to load new version pins.

schedule(context, topic, method, *_args, **_kwargs)

Must override schedule method for scheduler to work.

schedule_create_consistencygroup(context, group, request_spec_list, filter_properties_list)

Must override schedule method for scheduler to work.

schedule_create_group(context, group, group_spec, request_spec_list, group_filter_properties, filter_properties_list)

Must override schedule method for scheduler to work.

schedule_create_volume(context, request_spec, filter_properties)

Must override schedule method for scheduler to work.

update_service_capabilities(service_name, host, capabilities, cluster_name, timestamp)

Process a capability update from a service node.

generic_group_update_db(context, group, host, cluster_name)

Set the host and the scheduled_at field of a group.

Returns:A Group with the updated fields set properly.
group_update_db(context, group, host, cluster_name)

Set the host and the scheduled_at field of a consistencygroup.

Returns:A Consistencygroup with the updated fields set properly.
volume_update_db(context, volume_id, host, cluster_name)

Set the host, cluster_name, and set the scheduled_at field of a volume.

Returns:A Volume with the updated fields set properly.

The cinder.scheduler.filter_scheduler Driver

The FilterScheduler is for creating volumes.

You can customize this scheduler by specifying your own volume Filters and Weighing Functions.

class FilterScheduler(*args, **kwargs)

Bases: cinder.scheduler.driver.Scheduler

Scheduler that can be used for filtering and weighing.

backend_passes_filters(context, backend, request_spec, filter_properties)

Check if the specified backend passes the filters.

find_retype_backend(context, request_spec, filter_properties=None, migration_policy='never')

Find a backend that can accept the volume with its new type.

get_pools(context, filters)
populate_filter_properties(request_spec, filter_properties)

Stuff things into filter_properties.

Can be overridden in a subclass to add more data.

schedule(context, topic, method, *args, **kwargs)

Schedule contract that returns best-suited host for this request.

schedule_create_consistencygroup(context, group, request_spec_list, filter_properties_list)
schedule_create_group(context, group, group_spec, request_spec_list, group_filter_properties, filter_properties_list)
schedule_create_volume(context, request_spec, filter_properties)

Tests

The cinder.tests.unit.scheduler Module