cinder.volume.volume_types module

Built-in volume type properties.

add_volume_type_access(context: cinder.context.RequestContext, volume_type_id: Optional[str], project_id: str) None

Add access to volume type for project_id.

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

Creates volume types.

destroy(context: 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


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

get_all_types(context: context.RequestContext, inactive: int = 0, filters: Optional[dict] = None, marker: Optional[dict[str, Any]] = None, limit: Optional[int] = None, sort_keys: Optional[list[str]] = None, sort_dirs: Optional[list[str]] = None, offset: Optional[int] = None, list_result: bool = False) Union[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: context.RequestContext, identity: str) dict[str, Any]

Retrieves volume type by id or name

get_default_volume_type(contxt: Optional[context.RequestContext] = None) dict[str, Any]

Get the default volume type.


VolumeTypeDefaultMisconfiguredError – when the configured default is not found

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

Retrieves single volume type by id.

get_volume_type_by_name(context: context.RequestContext, name: Optional[str]) dict[str, Any]

Retrieves single volume type by name.

get_volume_type_encryption(context: cinder.context.RequestContext, volume_type_id: Optional[str]) Optional[dict]
get_volume_type_extra_specs(volume_type_id: str, key: Union[str, bool] = False) Union[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: cinder.context.RequestContext, volume_type_id: str) bool
is_public_volume_type(context: cinder.context.RequestContext, volume_type_id: str) bool

Return is_public boolean value of volume type

notify_about_volume_type_access_usage(context: cinder.context.RequestContext, volume_type_id: str, project_id: str, event_suffix: str, host: Optional[str] = None) None

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

  • 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: context.RequestContext, volume_type: Optional[dict[str, Any]], size: Union[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: cinder.context.RequestContext, volume_type_id: Optional[str], project_id: str) None

Remove access to volume type for project_id.

update(context: cinder.context.RequestContext, id: Optional[str], name: Optional[str], description: Optional[str], is_public: Optional[bool] = None) None

Update volume type by id.

volume_types_diff(context: 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,
                    'key2': (value_in_1st_vol_type,
    'qos_specs': {'key1': (value_in_1st_vol_type,
                  'key2': (value_in_1st_vol_type,
    'encryption': {'cipher': (value_in_1st_vol_type,
                  {'key_size': (value_in_1st_vol_type,
volume_types_encryption_changed(context: cinder.context.RequestContext, vol_type_id1: str, vol_type_id2: str) bool

Return whether encryptions of two volume types are same.