cinder.scheduler.host_manager module

Manage backends in the current zone.

class BackendState(host: str, cluster_name: str | None, capabilities: ReadOnlyDict | None | dict = None, service=None)

Bases: object

Mutable and immutable information tracked for a volume backend.

property backend_id: str
consume_from_volume(volume: Volume, update_time: bool = True) None

Incrementally update host state from a volume.

static get_storage_protocol_variants(storage_protocol)
update_backend(capability: dict) None
update_capabilities(capabilities: ReadOnlyDict | None | dict = None, service: dict | None = None) None
update_from_volume_capability(capability: dict[str, Any], service=None) None

Update information about a host from its volume_node info.

‘capability’ is the status info reported by volume backend, a typical capability looks like this:

{
 capability = {
     'volume_backend_name': 'Local iSCSI', #
     'vendor_name': 'OpenStack',           #  backend level
     'driver_version': '1.0',              #  mandatory/fixed
     'storage_protocol': 'iSCSI',          #  stats&capabilities

     'active_volumes': 10,                 #
     'IOPS_provisioned': 30000,            #  optional custom
     'fancy_capability_1': 'eat',          #  stats & capabilities
     'fancy_capability_2': 'drink',        #

     'pools': [
         {'pool_name': '1st pool',         #
          'total_capacity_gb': 500,        #  mandatory stats for
          'free_capacity_gb': 230,         #  pools
          'allocated_capacity_gb': 270,    #
          'QoS_support': 'False',          #
          'reserved_percentage': 0,        #

          'dying_disks': 100,              #
          'super_hero_1': 'spider-man',    #  optional custom
          'super_hero_2': 'flash',         #  stats & capabilities
          'super_hero_3': 'neoncat'        #
         },
         {'pool_name': '2nd pool',
          'total_capacity_gb': 1024,
          'free_capacity_gb': 1024,
          'allocated_capacity_gb': 0,
          'QoS_support': 'False',
          'reserved_percentage': 0,

          'dying_disks': 200,
          'super_hero_1': 'superman',
          'super_hero_2': ' ',
          'super_hero_2': 'Hulk'
         }
     ]
 }
}
update_pools(capability: dict | None, service) None

Update storage pools information from backend reported info.

class HostManager

Bases: object

Base HostManager class.

ALLOWED_SERVICE_NAMES = ('volume', 'backup')
REQUIRED_KEYS = frozenset({'allocated_capacity_gb', 'free_capacity_gb', 'max_over_subscription_ratio', 'pool_name', 'provisioned_capacity_gb', 'reserved_percentage', 'thick_provisioning_support', 'thin_provisioning_support', 'total_capacity_gb'})
backend_state_cls

alias of BackendState

first_receive_capabilities() bool
get_all_backend_states(context: RequestContext) Iterable

Returns a dict of all the backends the HostManager knows about.

Each of the consumable resources in BackendState are populated with capabilities scheduler received from RPC.

For example:

{‘192.168.1.100’: BackendState(), …}

get_az(volume: Volume, availability_zone: str | None) str | None
get_backup_host(volume: Volume, availability_zone: str | None, driver=None) str
get_filtered_backends(backends, filter_properties, filter_class_names=None)

Filter backends and return only ones passing all filters.

get_pools(context: RequestContext, filters: dict | None = None) list[dict]

Returns a dict of all pools on all hosts HostManager knows about.

get_usage_and_notify(capa_new: dict, updated_pools: Iterable[dict], host: str, timestamp) None
get_weighed_backends(backends, weight_properties, weigher_class_names=None) list

Weigh the backends.

has_all_capabilities() bool
notify_service_capabilities(service_name, backend, capabilities, timestamp)

Notify the ceilometer with updated volume stats

revert_volume_consumed_capacity(pool_name: str, size: int) None
update_service_capabilities(service_name: str, host: str, capabilities: dict, cluster_name: str | None, timestamp) None

Update the per-service capabilities based on this notification.

class PoolState(host: str, cluster_name: str | None, capabilities: ReadOnlyDict | None | dict, pool_name: str)

Bases: BackendState

update_from_volume_capability(capability: dict[str, Any], service=None) None

Update information about a pool from its volume_node info.

update_pools(capability)

Update storage pools information from backend reported info.

class ReadOnlyDict(source: ReadOnlyDict | None | dict = None)

Bases: Mapping

A read-only dict.