cinder.volume.volume_types module

Built-in volume type properties.

add_volume_type_access(context: RequestContext, volume_type_id: str | None, project_id: str) None

Add access to volume type for project_id.

create(context: RequestContext, name: str, extra_specs: dict[str, Any] | None = None, is_public: bool = True, projects: list[str] | None = None, description: str | None = None)

Creates volume types.

destroy(context: RequestContext, id: str) dict[str, Any]

Marks volume types as deleted.

There must exist at least one volume type (i.e. the default type) in the deployment. This method achieves that by ensuring: 1) the default_volume_type is set and is a valid one 2) the type requested to delete isn’t the default type

Raises:

VolumeTypeDefaultDeletionError – when the type requested to delete is the default type

get_all_types(context: RequestContext, inactive: int = 0, filters: dict | None = None, marker: dict[str, Any] | None = None, limit: int | None = None, sort_keys: list[str] | None = None, sort_dirs: list[str] | None = None, offset: int | None = None, list_result: bool = False) dict[str, Any] | list

Get all non-deleted volume_types.

Pass true as argument if you want deleted volume types returned also.

get_by_name_or_id(context: RequestContext, identity: str) dict[str, Any]

Retrieves volume type by id or name

get_default_volume_type(contxt: RequestContext | None = None) dict[str, Any]

Get the default volume type.

Raises:

VolumeTypeDefaultMisconfiguredError – when the configured default is not found

get_volume_type(ctxt: RequestContext | None, id: str | None, expected_fields: Iterable[str] | None = None) dict[str, Any]

Retrieves single volume type by id.

get_volume_type_by_name(context: RequestContext, name: str | None) dict[str, Any]

Retrieves single volume type by name.

get_volume_type_encryption(context: RequestContext, volume_type_id: str | None) dict | None
get_volume_type_extra_specs(volume_type_id: str, key: str | bool = False) dict | bool
get_volume_type_qos_specs(volume_type_id: str) dict[str, Any]

Get all qos specs for given volume type.

is_encrypted(context: RequestContext, volume_type_id: str) bool
is_public_volume_type(context: RequestContext, volume_type_id: str) bool

Return is_public boolean value of volume type

notify_about_volume_type_access_usage(context: RequestContext, volume_type_id: str, project_id: str, event_suffix: str, host: str | None = None) None

Notify about successful usage type-access-(add/remove) command.

Parameters:
  • context – security context

  • volume_type_id – volume type uuid

  • project_id – tenant uuid

  • event_suffix – name of called operation access-(add/remove)

  • host – hostname

provision_filter_on_size(context: RequestContext, volume_type: dict[str, Any] | None, size: str | int) None

This function filters volume provisioning requests on size limits.

If a volume type has provisioning size min/max set, this filter will ensure that the volume size requested is within the size limits specified in the volume type.

remove_volume_type_access(context: RequestContext, volume_type_id: str | None, project_id: str) None

Remove access to volume type for project_id.

update(context: RequestContext, id: str | None, name: str | None, description: str | None, is_public: bool | None = None) None

Update volume type by id.

volume_types_diff(context: RequestContext, vol_type_id1: str, vol_type_id2: str) tuple[dict[str, Any], bool]

Returns a ‘diff’ of two volume types and whether they are equal.

Returns a tuple of (diff, equal), where ‘equal’ is a boolean indicating whether there is any difference, and ‘diff’ is a dictionary with the following format:

{
    'extra_specs': {'key1': (value_in_1st_vol_type,
                             value_in_2nd_vol_type),
                    'key2': (value_in_1st_vol_type,
                             value_in_2nd_vol_type),
                    {...}}
    'qos_specs': {'key1': (value_in_1st_vol_type,
                           value_in_2nd_vol_type),
                  'key2': (value_in_1st_vol_type,
                           value_in_2nd_vol_type),
                  {...}}
    'encryption': {'cipher': (value_in_1st_vol_type,
                              value_in_2nd_vol_type),
                  {'key_size': (value_in_1st_vol_type,
                                value_in_2nd_vol_type),
                   {...}}
}
volume_types_encryption_changed(context: RequestContext, vol_type_id1: str, vol_type_id2: str) bool

Return whether encryptions of two volume types are same.