cinder.scheduler.filters.instance_locality_filter module

class InstanceLocalityFilter

Bases: BaseBackendFilter

Schedule volume on the same host as a given instance.

This filter enables selection of a storage back-end located on the host where the instance’s hypervisor is running. This provides data locality: the instance and the volume are located on the same physical machine.

In order to work:

  • The Extended Server Attributes extension needs to be active in Nova (this is by default), so that the ‘OS-EXT-SRV-ATTR:host’ property is returned when requesting instance info.

  • Either an account with privileged rights for Nova must be configured in Cinder configuration (configure a keystone authentication plugin in the [nova] section), or the user making the call needs to have sufficient rights (see ‘extended_server_attributes’ in Nova policy).

backend_passes(backend_state, filter_properties)

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

Override this in a subclass.