# Block Storage API

For details on how to use block_storage, see Using OpenStack Block Storage

## The BlockStorage Class

The block_storage high-level interface is available through the `block_storage` member of a `Connection` object. The `block_storage` member will only be added if the service is detected.

### Backup Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  backups(details=True, **query)

    Retrieve a generator of backups

    Parameters:

      - details (bool) – When set to `False` no additional details will be returned. The default, `True`, will cause objects with additional attributes to be returned.

      - query (dict) –

        Optional query parameters to be sent to limit the resources being returned:

        - offset: pagination marker

        - limit: pagination limit

        - sort_key: Sorts by an attribute. A valid value is name, status, container_format, disk_format, size, id, created_at, or updated_at. Default is created_at. The API uses the natural sorting direction of the sort_key attribute value.

        - sort_dir: Sorts by one or more sets of attribute and sort direction combinations. If you omit the sort direction in a set, default is desc.

    Returns:

      A generator of backup objects.

  get_backup(backup)

    Get a backup

    Parameters:

      backup – The value can be the ID of a backup or a `Backup` instance.

    Returns:

      Backup instance

    Return type:

      `Backup`

  create_backup(**attrs)

    Create a new Backup from attributes with native API

    Parameters:

      attrs (dict) – Keyword arguments which will be used to create a `Backup` comprised of the properties on the Backup class.

    Returns:

      The results of Backup creation

    Return type:

      `Backup`

  delete_backup(backup, ignore_missing=True, force=False)

    Delete a CloudBackup

    Parameters:

      - backup – The value can be the ID of a backup or a `Backup` instance

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the zone does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent zone.

      - force (bool) – Whether to try forcing backup deletion

    Returns:

      `None`

  restore_backup(backup, volume_id, name)

    Restore a Backup to volume

    Parameters:

      - backup – The value can be the ID of a backup or a `Backup` instance

      - volume_id – The ID of the volume to restore the backup to.

      - name – The name for new volume creation to restore.

    Returns:

      Updated backup instance

    Return type:

      `Backup`

  reset_backup_status(backup, status)

    Reset status of the backup

    Parameters:

      - backup – The value can be either the ID of a backup or a `Backup` instance.

      - status (str) – New backup status

    Returns:

      None

### Capabilities Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_capabilities(host)

    Get a backend’s capabilites

    Parameters:

      host – Specified backend to obtain volume stats and properties.

    Returns:

      One :class: ~openstack.block_storage.v2.capabilites.Capabilities instance.

    Raises:

      `NotFoundException` when no resource can be found.

### Limits Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_limits(project=None)

    Retrieves limits

    Parameters:

      project – A project to get limits for. The value can be either the ID of a project or an `Project` instance.

    Returns:

      A Limits object, including both `AbsoluteLimit` and `RateLimit`

    Return type:

      `Limits`

### QuotaClassSet Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_quota_class_set(quota_class_set='default')

    Get a single quota class set

    Only one quota class is permitted, `default`.

    Parameters:

      quota_class_set – The value can be the ID of a quota class set (only `default` is supported) or a `QuotaClassSet` instance.

    Returns:

      One `QuotaClassSet`

    Raises:

      `NotFoundException` when no resource can be found.

  update_quota_class_set(quota_class_set, **attrs)

    Update a QuotaClassSet.

    Only one quota class is permitted, `default`.

    Parameters:

      - quota_class_set – Either the ID of a quota class set (only `default` is supported) or a `QuotaClassSet` instance.

      - attrs – The attributes to update on the QuotaClassSet represented by `quota_class_set`.

    Returns:

      The updated QuotaSet

    Return type:

      `QuotaSet`

### QuotaSet Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_quota_set(project, usage=False, **query)

    Show QuotaSet information for the project

    Parameters:

      - project – ID or instance of `Project` of the project for which the quota should be retrieved

      - usage (bool) – When set to `True` quota usage and reservations would be filled.

      - query (dict) – Additional query parameters to use.

    Returns:

      One `QuotaSet`

    Raises:

      `NotFoundException` when no resource can be found.

  get_quota_set_defaults(project)

    Show QuotaSet defaults for the project

    Parameters:

      project – ID or instance of `Project` of the project for which the quota should be retrieved

    Returns:

      One `QuotaSet`

    Raises:

      `NotFoundException` when no resource can be found.

  revert_quota_set(project, **query)

    Reset Quota for the project/user.

    Parameters:

      - project – ID or instance of `Project` of the project for which the quota should be resetted.

      - query (dict) – Additional parameters to be used.

    Returns:

      `None`

  update_quota_set(project, **attrs)

    Update a QuotaSet.

    Parameters:

      - project – ID or instance of `Project` of the project for which the quota should be reset.

      - attrs – The attributes to update on the QuotaSet represented by `quota_set`.

    Returns:

      The updated QuotaSet

    Return type:

      `QuotaSet`

### Service Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  find_service(name_or_id, ignore_missing=True, **query)

    Find a single service

    Parameters:

      - name_or_id – The name or ID of a service

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

      - query (dict) – Additional attributes like ‘host’

    Returns:

      One: class:~openstack.block_storage.v2.service.Service or None

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  services(**query)

    Return a generator of service

    Parameters:

      query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of Service objects

    Return type:

      class: ~openstack.block_storage.v2.service.Service

  enable_service(service)

    Enable a service

    Parameters:

      service – Either the ID of a service or a `Service` instance.

    Returns:

      Updated service instance

    Return type:

      class: ~openstack.block_storage.v2.service.Service

  disable_service(service, *, reason=None)

    Disable a service

    Parameters:

      - service – Either the ID of a service or a `Service` instance

      - reason (str) – The reason to disable a service

    Returns:

      Updated service instance

    Return type:

      class: ~openstack.block_storage.v2.service.Service

  thaw_service(service)

    Thaw a service

    Parameters:

      service – Either the ID of a service or a `Service` instance

    Returns:

      Updated service instance

    Return type:

      class: ~openstack.block_storage.v2.service.Service

  freeze_service(service)

    Freeze a service

    Parameters:

      service – Either the ID of a service or a `Service` instance

    Returns:

      Updated service instance

    Return type:

      class: ~openstack.block_storage.v2.service.Service

  failover_service(service, *, backend_id=None)

    Failover a service

    Only applies to replicating cinder-volume services.

    Parameters:

      service – Either the ID of a service or a `Service` instance

    Returns:

      Updated service instance

    Return type:

      class: ~openstack.block_storage.v2.service.Service

### Snapshot Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_snapshot(snapshot)

    Get a single snapshot

    Parameters:

      snapshot – The value can be the ID of a snapshot or a `Snapshot` instance.

    Returns:

      One `Snapshot`

    Raises:

      `NotFoundException` when no resource can be found.

  snapshots(*, details=True, all_projects=False, **query)

    Retrieve a generator of snapshots

    Parameters:

      - details (bool) – When set to `False` `Snapshot` objects will be returned. The default, `True`, will cause `SnapshotDetail` objects to be returned.

      - all_projects (bool) – When set to `True`, list snapshots from all projects. Admin-only by default.

      - query (kwargs) –

        Optional query parameters to be sent to limit the snapshots being returned. Available parameters include:

        - name: Name of the snapshot as a string.

        - volume_id: volume id of a snapshot.

        - status: Value of the status of the snapshot so that you can filter on “available” for example.

    Returns:

      A generator of snapshot objects.

  create_snapshot(**attrs)

    Create a new snapshot from attributes

    Parameters:

      attrs (dict) – Keyword arguments which will be used to create a `Snapshot`, comprised of the properties on the Snapshot class.

    Returns:

      The results of snapshot creation

    Return type:

      `Snapshot`

  delete_snapshot(snapshot, ignore_missing=True)

    Delete a snapshot

    Parameters:

      - snapshot – The value can be either the ID of a snapshot or a `Snapshot` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the snapshot does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent snapshot.

    Returns:

      `None`

  reset_snapshot_status(snapshot, status)

    Reset status of the snapshot

    Parameters:

      - snapshot – The value can be either the ID of a backup or a `Snapshot` instance.

      - status (str) – New snapshot status

    Returns:

      None

### Stats Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  backend_pools(**query)

    Returns a generator of cinder Back-end storage pools

    Parameters:

      query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    :returns A generator of cinder Back-end storage pools objects

### Transfer Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_transfer(**attrs)

    Create a new Transfer record

    Parameters:

      - volume_id – The value is ID of the volume.

      - name – The value is name of the transfer

      - attrs (dict) – Keyword arguments which will be used to create a `Transfer` comprised of the properties on the Transfer class.

    Returns:

      The results of Transfer creation

    Return type:

      `Transfer`

  delete_transfer(transfer, ignore_missing=True)

    Delete a volume transfer

    Parameters:

      - transfer – The value can be either the ID of a transfer or a `Transfer`` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the transfer does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent transfer.

    Returns:

      `None`

  find_transfer(name_or_id, ignore_missing=True)

    Find a single transfer

    Parameters:

      - name_or_id – The name or ID a transfer

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the volume transfer does not exist.

    Returns:

      One `Transfer`

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  get_transfer(transfer)

    Get a single transfer

    Parameters:

      transfer – The value can be the ID of a transfer or a `Transfer` instance.

    Returns:

      One `Transfer`

    Raises:

      `NotFoundException` when no resource can be found.

  transfers(*, details=True, all_projects=False, **query)

    Retrieve a generator of transfers

    Parameters:

      - details (bool) – When set to `False` no extended attributes will be returned. The default, `True`, will cause objects with additional attributes to be returned.

      - all_projects (bool) – When set to `True`, list transfers from all projects. Admin-only by default.

      - query (kwargs) – Optional query parameters to be sent to limit the transfers being returned.

    Returns:

      A generator of transfer objects.

  accept_transfer(transfer_id, auth_key)

    Accept a Transfer

    Parameters:

      - transfer_id – The value can be the ID of a transfer or a `Transfer` instance.

      - auth_key – The key to authenticate volume transfer.

    Returns:

      The results of Transfer creation

    Return type:

      `Transfer`

### Type Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_type(type)

    Get a single type

    Parameters:

      type – The value can be the ID of a type or a `Type` instance.

    Returns:

      One `Type`

    Raises:

      `NotFoundException` when no resource can be found.

  types(**query)

    Retrieve a generator of volume types

    Returns:

      A generator of volume type objects.

  create_type(**attrs)

    Create a new type from attributes

    Parameters:

      attrs (dict) – Keyword arguments which will be used to create a `Type`, comprised of the properties on the Type class.

    Returns:

      The results of type creation

    Return type:

      `Type`

  delete_type(type, ignore_missing=True)

    Delete a type

    Parameters:

      - type – The value can be either the ID of a type or a `Type` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the type does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent type.

    Returns:

      `None`

### Volume Operations

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_volume(volume)

    Get a single volume

    Parameters:

      volume – The value can be the ID of a volume or a `Volume` instance.

    Returns:

      One `Volume`

    Raises:

      `NotFoundException` when no resource can be found.

  find_volume(name_or_id, ignore_missing=True, *, details=True, all_projects=False)

    Find a single volume

    Parameters:

      - volume – The name or ID a volume

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the volume does not exist.

      - details (bool) – When set to `False` no extended attributes will be returned. The default, `True`, will cause an object with additional attributes to be returned.

      - all_projects (bool) – When set to `True`, search for volume by name across all projects. Note that this will likely result in a higher chance of duplicates. Admin-only by default.

    Returns:

      One `Volume` or None.

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  volumes(*, details=True, all_projects=False, **query)

    Retrieve a generator of volumes

    Parameters:

      - details (bool) – When set to `False` no extended attributes will be returned. The default, `True`, will cause objects with additional attributes to be returned.

      - all_projects (bool) – When set to `True`, list volumes from all projects. Admin-only by default.

      - query (kwargs) –

        Optional query parameters to be sent to limit the volumes being returned. Available parameters include:

        - name: Name of the volume as a string.

        - status: Value of the status of the volume so that you can filter on “available” for example.

    Returns:

      A generator of volume objects.

  create_volume(**attrs)

    Create a new volume from attributes

    Parameters:

      attrs (dict) – Keyword arguments which will be used to create a `Volume`, comprised of the properties on the Volume class.

    Returns:

      The results of volume creation

    Return type:

      `Volume`

  delete_volume(volume, ignore_missing=True, *, force=False, cascade=False)

    Delete a volume

    Parameters:

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the volume does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent volume.

      - force (bool) – Whether to try forcing volume deletion.

      - cascade (bool) – Whether to remove any snapshots along with the volume.

    Returns:

      `None`

  extend_volume(volume, size)

    Extend a volume

    Parameters:

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - size – New volume size

    Returns:

      None

  retype_volume(volume, new_type, migration_policy='never')

    Retype the volume.

    Parameters:

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - new_type – The new volume type that volume is changed with. The value can be either the ID of the volume type or a `Type` instance.

      - migration_policy (str) – Specify if the volume should be migrated when it is re-typed. Possible values are on-demand or never. Default: never.

    Returns:

      None

  set_volume_bootable_status(volume, bootable)

    Set bootable status of the volume.

    Parameters:

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - bootable (bool) – Specifies whether the volume should be bootable or not.

    Returns:

      None

  set_volume_image_metadata(volume, **metadata)

    Update image metadata for a volume

    Parameters:

      - volume – Either the ID of a volume or a `Volume`.

      - metadata (kwargs) – Key/value pairs to be updated in the volume’s image metadata. No other metadata is modified by this call.

    Returns:

      None

  delete_volume_image_metadata(volume, keys=None)

    Delete metadata for a volume

    Parameters:

      - volume – Either the ID of a volume or a `Volume`.

      - keys (list) – The keys to delete. If left empty complete metadata will be removed.

    Returns:

      None

  reset_volume_status(volume, status=None, attach_status=None, migration_status=None)

    Reset volume statuses.

    Parameters:

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - status (str) – The new volume status.

      - attach_status (str) – The new volume attach status.

      - migration_status (str) – The new volume migration status (admin only).

    Returns:

      None

  attach_volume(volume, mountpoint, instance=None, host_name=None)

    Attaches a volume to a server.

    Parameters:

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - mountpoint (str) – The attaching mount point.

      - instance (str) – The UUID of the attaching instance.

      - host_name (str) – The name of the attaching host.

    Returns:

      None

  detach_volume(volume, attachment, force=False, connector=None)

    Detaches a volume from a server.

    Parameters:

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - attachment (str) – The ID of the attachment.

      - force (bool) – Whether to force volume detach (Rolls back an unsuccessful detach operation after you disconnect the volume.)

      - connector (dict) – The connector object.

    Returns:

      None

  unmanage_volume(volume)
    Removes a volume from Block Storage management without removing the

      back-end storage object that is associated with it.

    Parameters:

      volume – The value can be either the ID of a volume or a `Volume` instance.

    Returns:

      None

  migrate_volume(volume, host=None, force_host_copy=False, lock_volume=False)

    Migrates a volume to the specified host.

    Parameters:

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - host (str) – The target host for the volume migration. Host format is host@backend.

      - force_host_copy (bool) – If false (the default), rely on the volume backend driver to perform the migration, which might be optimized. If true, or the volume driver fails to migrate the volume itself, a generic host-based migration is performed.

      - lock_volume (bool) – If true, migrating an available volume will change its status to maintenance preventing other operations from being performed on the volume such as attach, detach, retype, etc.

    Returns:

      None

  complete_volume_migration(volume, new_volume, error=False)

    Complete the migration of a volume.

    Parameters:

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - new_volume (str) – The UUID of the new volume.

      - error (bool) – Used to indicate if an error has occured elsewhere that requires clean up.

    Returns:

      None

  get_volume_metadata(volume)

    Return a dictionary of metadata for a volume

    Parameters:

      volume – Either the ID of a volume or a `Volume`.

    Returns:

      A `Volume` with the volume’s metadata. All keys and values are Unicode text.

    Return type:

      `Volume`

  set_volume_metadata(volume, **metadata)

    Update metadata for a volume

    Parameters:

      - volume – Either the ID of a volume or a `Volume`.

      - metadata (kwargs) – Key/value pairs to be updated in the volume’s metadata. No other metadata is modified by this call. All keys and values are stored as Unicode.

    Returns:

      A `Volume` with the volume’s metadata. All keys and values are Unicode text.

    Return type:

      `Volume`

  delete_volume_metadata(volume, keys=None)

    Delete metadata for a volume

    Parameters:

      - volume – Either the ID of a volume or a `Volume`.

      - keys (list) – The keys to delete. If left empty complete metadata will be removed.

    Return type:

      `None`

### Helpers

class openstack.block_storage.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  wait_for_status(res, status='available', failures=None, interval=2, wait=None, attribute='status', callback=None)

    Wait for the resource to be in a particular status.

    Parameters:

      - session – The session to use for making this request.

      - resource – The resource to wait on to reach the status. The resource must have a status attribute specified via `attribute`.

      - status – Desired status of the resource.

      - failures – Statuses that would indicate the transition failed such as ‘ERROR’. Defaults to [‘ERROR’].

      - interval – Number of seconds to wait between checks.

      - wait – Maximum number of seconds to wait for transition. Set to `None` to wait forever.

      - attribute – Name of the resource attribute that contains the status.

      - callback – A callback function. This will be called with a single value, progress. This is API specific but is generally a percentage value from 0-100.

    Returns:

      The updated resource.

    Raises:

      `ResourceTimeout` if the transition to status failed to occur in `wait` seconds.

    Raises:

      `ResourceFailure` if the resource transitioned to one of the states in `failures`.

    Raises:

      `AttributeError` if the resource does not have a `status` attribute

  wait_for_delete(res, interval=2, wait=120, callback=None)

    Wait for a resource to be deleted.

    Parameters:

      - res – The resource to wait on to be deleted.

      - interval – Number of seconds to wait before to consecutive checks.

      - wait – Maximum number of seconds to wait before the change.

      - callback – A callback function. This will be called with a single value, progress, which is a percentage value from 0-100.

    Returns:

      The resource is returned on success.

    Raises:

      `ResourceTimeout` if transition to delete failed to occur in the specified seconds.

this page last updated: 2026-01-16 23:06:19

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.