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.
Volume Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
get_volume
- get_volume(volume)
Get a single volume
- Parameters:
volume The value can be the ID of a volume or aVolume instance.
- Returns:
One Volume
- Raises:
ResourceNotFoundwhen no resource can be found.
find_volume
- find_volume(name_or_id, ignore_missing, details, all_projects)
Find a single volume
- Parameters:
snapshot The name or ID a volumeignore_missing (bool) When set to FalseResourceNotFound will be raisedwhen the volume does not exist.details (bool) When set to False no extended attributeswill be returned. The default, True, will cause objects withadditional attributes to be returned.all_projects (bool) When set to True, search for volume byname across all projects. Note that this will likely result ina higher chance of duplicates. Admin-only by default.
- Returns:
One Volume
- Raises:
ResourceNotFoundwhen no resource can be found.
- Raises:
DuplicateResource when multipleresources are found.
volumes
- volumes(details, all_projects, **query)
Retrieve a generator of volumes
- Parameters:
details (bool) When set to False no extended attributeswill be returned. The default, True, will cause objects withadditional attributes to be returned.all_projects (bool) When set to True, list volumes from allprojects. Admin-only by default.query (kwargs) Optional query parameters to be sent to limitthe 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 filteron available for example.
- Returns:
A generator of volume objects.
create_volume
- create_volume(**attrs)
Create a new volume from attributes
- Parameters:
attrs (dict) Keyword arguments which will be used to createa Volume,comprised of the properties on the Volume class.
- Returns:
The results of volume creation
- Return type:
Volume
delete_volume
- delete_volume(volume, ignore_missing, force)
Delete a volume
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.ignore_missing (bool) When set to FalseResourceNotFound will beraised when the volume does not exist.When set to True, no exception will be set whenattempting to delete a nonexistent volume.force (bool) Whether to try forcing volume deletion.
- Returns:
None
update_volume
- update_volume(volume, **attrs)
Update a volume
- Parameters:
volume Either the ID of a volume or aVolume instance.attrs (dict) The attributes to update on the volume.
- Returns:
The updated volume
- Return type:
Volume
get_volume_metadata
- get_volume_metadata(volume)
Return a dictionary of metadata for a volume
- Parameters:
volume Either the ID of a volume or aVolume.
- Returns:
A Volume with thevolumes metadata. All keys and values are Unicode text.
- Return type:
Volume
set_volume_metadata
- set_volume_metadata(volume, **metadata)
Update metadata for a volume
- Parameters:
volume Either the ID of a volume or aVolume.metadata (kwargs) Key/value pairs to be updated in the volumesmetadata. No other metadata is modified by this call. All keysand values are stored as Unicode.
- Returns:
A Volume with thevolumes metadata. All keys and values are Unicode text.
- Return type:
Volume
delete_volume_metadata
- delete_volume_metadata(volume, keys)
Delete metadata for a volume
- Parameters:
volume Either the ID of a volume or aVolume.keys (list) The keys to delete. If left empty completemetadata will be removed.
- Return type:
None
extend_volume
- extend_volume(volume, size)
Extend a volume
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.size New volume size
- Returns:
None
set_volume_readonly
- set_volume_readonly(volume, readonly)
Set a volumeâs read-only flag.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.readonly (bool) Whether the volume should be a read-only volumeor not.
- Returns:
None
retype_volume
- retype_volume(volume, new_type, migration_policy)
Retype the volume.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.new_type (str) The new volume type that volume is changed with.migration_policy (str) Specify if the volume should be migratedwhen it is re-typed. Possible values are on-demand or never.Default: never.
- Returns:
None
set_volume_bootable_status
- 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 aVolume instance.bootable (bool) Specifies whether the volume should be bootableor not.
- Returns:
None
reset_volume_status
- reset_volume_status(volume, status, attach_status, migration_status)
Reset volume statuses.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.status (str) The new volume status.attach_status (str) The new volume attach status.migration_status (str) The new volume migration status (adminonly).
- Returns:
None
revert_volume_to_snapshot
- revert_volume_to_snapshot(volume, snapshot)
Revert a volume to its latest snapshot.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.snapshot The value can be either the ID of a snapshot or aSnapshot instance.
- Returns:
None
attach_volume
- attach_volume(volume, mountpoint, instance, host_name)
Attaches a volume to a server.
- Parameters:
volume The value can be either the ID of a volume or aVolume 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
- detach_volume(volume, attachment, force, connector)
Detaches a volume from a server.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.attachment (str) The ID of the attachment.force (bool) Whether to force volume detach (Rolls back anunsuccessful detach operation after you disconnect the volume.)connector (dict) The connector object.
- Returns:
None
manage_volume
- manage_volume(**attrs)
allocating new storage.
- Creates a volume by using existing storage rather than:
allocating new storage.
- Parameters:
attrs (dict) Keyword arguments which will be used to createa Volume,comprised of the properties on the Volume class.
- Returns:
The results of volume creation
- Return type:
Volume
unmanage_volume
- unmanage_volume(volume)
back-end storage object that is associated with it.
- 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 aVolume instance.
- Returns:
None
migrate_volume
- migrate_volume(volume, host, force_host_copy, lock_volume, cluster)
Migrates a volume to the specified host.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.host (str) The target host for the volume migration. Hostformat is host@backend.force_host_copy (bool) If false (the default), rely on the volumebackend 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 willchange its status to maintenance preventing other operations frombeing performed on the volume such as attach, detach, retype, etc.cluster (str) The target cluster for the volume migration.Cluster format is cluster@backend. Starting with microversion3.16, either cluster or host must be specified. If host isspecified and is part of a cluster, the cluster is used as thetarget for the migration.
- Returns:
None
complete_volume_migration
- complete_volume_migration(volume, new_volume, error)
Complete the migration of a volume.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.new_volume (str) The UUID of the new volume.error (bool) Used to indicate if an error has occured elsewherethat requires clean up.
- Returns:
None
upload_volume_to_image
- upload_volume_to_image(volume, image_name, force, disk_format, container_format, visibility, protected)
Uploads the specified volume to image service.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.name (str image) The name for the new image.force (bool) Enables or disables upload of a volume that isattached to an instance.disk_format (str) Disk format for the new image.container_format (str) Container format for the new image.visibility (str) The visibility property of the new image.protected (str) Whether the new image is protected.
- Returns:
dictionary describing the image.
reserve_volume
- reserve_volume(volume)
Mark volume as reserved.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.
- Returns:
None
unreserve_volume
- unreserve_volume(volume)
Unmark volume as reserved.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.
- Returns:
None
begin_volume_detaching
- begin_volume_detaching(volume)
Update volume status to âdetachingâ.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.
- Returns:
None
abort_volume_detaching
- abort_volume_detaching(volume)
Update volume status to âin-useâ.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.
- Returns:
None
init_volume_attachment
- init_volume_attachment(volume, connector)
Initialize volume attachment.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.connector (dict) The connector object.
- Returns:
Dictionary containing the modified connector object
terminate_volume_attachment
- terminate_volume_attachment(volume, connector)
Update volume status to âin-useâ.
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.connector (dict) The connector object.
- Returns:
None
Backend Pools Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
backend_pools
- backend_pools(**query)
Returns a generator of cinder Back-end storage pools
- Parameters:
query (kwargs) Optional query parameters to be sent to limitthe resources being returned.
Backup Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
backups
- backups(details, **query)
Retrieve a generator of backups
- Parameters:
details (bool) When set to Falseno 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 theresources being returned:offset: pagination markerlimit: pagination limitsort_key: Sorts by an attribute. A valid value isname, status, container_format, disk_format, size, id,created_at, or updated_at. Default is created_at.The API uses the natural sorting direction of thesort_key attribute value.sort_dir: Sorts by one or more sets of attribute and sortdirection combinations. If you omit the sort directionin a set, default is desc.project_id: Project ID to query backups for.
- Returns:
A generator of backup objects.
get_backup
- get_backup(backup)
Get a backup
- Parameters:
backup The value can be the ID of a backupor a Backupinstance.
- Returns:
Backup instance
- Return type:
Backup
find_backup
- find_backup(name_or_id, ignore_missing, details)
Find a single backup
- Parameters:
snapshot The name or ID a backupignore_missing (bool) When set to FalseResourceNotFound will be raisedwhen the backup does not exist.details (bool) When set to False no additional details willbe returned. The default, True, will cause objects withadditional attributes to be returned.
- Returns:
One Backup
- Raises:
ResourceNotFoundwhen no resource can be found.
- Raises:
DuplicateResource when multipleresources are found.
create_backup
- create_backup(**attrs)
Create a new Backup from attributes with native API
- Parameters:
attrs (dict) Keyword arguments which will be used to createa Backupcomprised of the properties on the Backup class.
- Returns:
The results of Backup creation
- Return type:
Backup
delete_backup
- delete_backup(backup, ignore_missing, force)
Delete a CloudBackup
- Parameters:
backup The value can be the ID of a backup or aBackup instanceignore_missing (bool) When set to FalseResourceNotFound will be raised whenthe zone does not exist.When set to True, no exception will be set when attempting todelete a nonexistent zone.force (bool) Whether to try forcing backup deletion
- Returns:
None
restore_backup
- restore_backup(backup, volume_id, name)
Restore a Backup to volume
- Parameters:
backup The value can be the ID of a backup or aBackup instancevolume_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
- reset_backup(backup, status)
Reset status of the backup
- Parameters:
backup The value can be either the ID of a backup or aBackup instance.status (str) New backup status
- Returns:
None
Availability Zone Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
availability_zones
- availability_zones()
Return a generator of availability zones
- Returns:
A generator of availability zone
- Return type:
AvailabilityZone
Limits Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
get_limits
- get_limits(project)
Retrieves limits
- Parameters:
project A project to get limits for. The value can be eitherthe ID of a project or anProject instance.
- Returns:
A Limit object, including bothAbsoluteLimit andRateLimit
- Return type:
Limit
Capabilities Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
get_capabilities
- get_capabilities(host)
Get a backendâs capabilites
- Parameters:
host Specified backend to obtain volume stats and properties.
- Returns:
One :class:~openstack.block_storage.v3.capabilites.Capabilities instance.
- Raises:
ResourceNotFound when noresource can be found.
Group Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
get_group
- get_group(group_id, **attrs)
Get a group
- Parameters:
group_id The ID of the group to get.attrs (dict) Optional query parameters to be sent to limit theresources being returned.
- Returns:
A Group instance.
- Return type:
group
find_group
- find_group(name_or_id, ignore_missing, details)
Find a single group
- Parameters:
name_or_id The name or ID of a group.ignore_missing (bool) When set to FalseResourceNotFound will be raisedwhen the group snapshot does not exist.details (bool) When set to False, no additional details willbe returned. The default, True, will cause additional detailsto be returned.
- Returns:
One Group
- Raises:
ResourceNotFoundwhen no resource can be found.
- Raises:
DuplicateResource when multipleresources are found.
groups
- groups(details, **query)
Retrieve a generator of groups
- Parameters:
details (bool) When set to False, no additional details willbe returned. The default, True, will cause additional detailsto be returned.query (dict) Optional query parameters to be sent to limit theresources being returned:all_tenants: Shows details for all project.sort: Comma-separated list of sort keys and optional sortdirections.limit: Returns a number of items up to the limit value.offset: Used in conjunction with limit to return a slice ofitems. Specifies where to start in the list.marker: The ID of the last-seen item.list_volume: Show volume ids in this group.detailed: If True, will list groups with details.search_opts: Search options.
- Returns:
A generator of group objects.
create_group
- create_group(**attrs)
Create a new group from attributes
- Parameters:
attrs (dict) Keyword arguments which will be used to createa Group comprised ofthe properties on the Group class.
- Returns:
The results of group creation.
- Return type:
Group.
create_group_from_source
- create_group_from_source(**attrs)
Creates a new group from source
- Parameters:
attrs (dict) Keyword arguments which will be used to createa Group comprised ofthe properties on the Group class.
- Returns:
The results of group creation.
- Return type:
Group.
reset_group_state
- reset_group_state(group, status)
Reset group status
- Parameters:
group The Groupto set the state.status The status for a group.
- Returns:
None
delete_group
- delete_group(group, delete_volumes)
Delete a group
- Parameters:
group The Group todelete.delete_volumes (bool) When set to True, volumes in groupwill be deleted.
- Returns:
None.
update_group
- update_group(group, **attrs)
Update a group
- Parameters:
group The value can be the ID of a group or aGroup instance.attrs (dict) The attributes to update on the group.
- Returns:
The updated group
- Return type:
Group
Group Snapshot Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
get_group_snapshot
- get_group_snapshot(group_snapshot_id)
Get a group snapshot
- Parameters:
group_snapshot_id The ID of the group snapshot to get.
- Returns:
A GroupSnapshot instance.
- Return type:
group_snapshot
find_group_snapshot
- find_group_snapshot(name_or_id, ignore_missing, details)
Find a single group snapshot
- Parameters:
name_or_id The name or ID of a group snapshot.ignore_missing (bool) When set to FalseResourceNotFound will be raisedwhen the group snapshot does not exist.details (bool) When set to False, no additional details willbe returned. The default, True, will cause additional detailsto be returned.
- Returns:
One group_snapshot
- Raises:
ResourceNotFoundwhen no resource can be found.
- Raises:
DuplicateResource when multipleresources are found.
group_snapshots
- group_snapshots(details, **query)
Retrieve a generator of group snapshots
- Parameters:
details (bool) When True, returnsGroupSnapshotobjects with additional attributes filled.query (kwargs) Optional query parameters to be sent to limitthe group snapshots being returned.
- Returns:
A generator of group snapshtos.
create_group_snapshot
- create_group_snapshot(**attrs)
Create a group snapshot
- Parameters:
attrs (dict) Keyword arguments which will be used to create aGroupSnapshotcomprised of the properties on the GroupSnapshot class.
- Returns:
The results of group snapshot creation.
- Return type:
group_snapshot.
reset_group_snapshot_state
- reset_group_snapshot_state(group_snapshot, state)
Reset group snapshot status
- Parameters:
group_snapshot TheGroupSnapshotto set the state.state The state of the group snapshot to be set.
- Returns:
None
delete_group_snapshot
- delete_group_snapshot(group_snapshot, ignore_missing)
Delete a group snapshot
- Parameters:
group_snapshot The GroupSnapshot to delete.
- Returns:
None
Group Type Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
get_group_type
- get_group_type(group_type)
Get a specific group type
- Parameters:
group_type The value can be the ID of a group typeor a GroupTypeinstance.
- Returns:
One :class:~openstack.block_storage.v3.group_type.GroupType instance.
- Raises:
ResourceNotFound when noresource can be found.
find_group_type
- find_group_type(name_or_id, ignore_missing)
Find a single group type
- Parameters:
name_or_id The name or ID of a group type.ignore_missing (bool) When set to FalseResourceNotFound will be raisedwhen the group type does not exist.
- Returns:
OneGroupType
- Raises:
ResourceNotFound when noresource can be found.
- Raises:
DuplicateResource when multipleresources are found.
group_types
- group_types(**query)
Retrive a generator of group types
- Parameters:
query (dict) Optional query parameters to be sent to limit theresources being returned:sort: Comma-separated list of sort keys and optional sortdirections in the form of <key> [:<direction>]. A validdirection is asc (ascending) or desc (descending).limit: Requests a page size of items. Returns a number of itemsup to a limit value. Use the limit parameter to make aninitial limited request and use the ID of the last-seen itemfrom the response as the marker parameter value in asubsequent limited request.offset: Used in conjunction with limit to return a slice ofitems. Is where to start in the list.marker: The ID of the last-seen item.
- Returns:
A generator of group type objects.
create_group_type
- create_group_type(**attrs)
Create a group type
- Parameters:
attrs (dict) Keyword arguments which will be used to createa GroupTypecomprised of the properties on the GroupType class.
- Returns:
The results of group type creation.
- Return type:
GroupTye.
delete_group_type
- delete_group_type(group_type, ignore_missing)
Delete a group type
- Parameters:
group_type The value can be the ID of a group typeor a GroupTypeinstance.ignore_missing (bool) When set to FalseResourceNotFound will be raised whenthe zone does not exist.When set to True, no exception will be set when attempting todelete a nonexistent zone.
- Returns:
None
update_group_type
- update_group_type(group_type, **attrs)
Update a group_type
- Parameters:
group_type The value can be the ID of a group type or aGroupTypeinstance.attrs (dict) The attributes to update on the group type.
- Returns:
The updated group type.
- Return type:
GroupType
fetch_group_type_group_specs
- fetch_group_type_group_specs(group_type)
Lists group specs of a group type.
- Parameters:
group_type Either the ID of a group type or aGroupType instance.
- Returns:
One GroupType
create_group_type_group_specs
- create_group_type_group_specs(group_type, group_specs)
Create group specs for a group type.
- Parameters:
group_type Either the ID of a group type or aGroupType instance.group_specs (dict) dict of extra specs
- Returns:
One GroupType
get_group_type_group_specs_property
- get_group_type_group_specs_property(group_type, prop)
Retrieve a group spec property for a group type.
- Parameters:
group_type Either the ID of a group type or aGroupType instance.prop (str) Property name.
- Returns:
String value of the requested property.
update_group_type_group_specs_property
- update_group_type_group_specs_property(group_type, prop, val)
Update a group spec property for a group type.
- Parameters:
group_type Either the ID of a group type or aGroupType instance.prop (str) Property name.val (str) Property value.
- Returns:
String value of the requested property.
delete_group_type_group_specs_property
- delete_group_type_group_specs_property(group_type, prop)
Delete a group spec property from a group type.
- Parameters:
group_type Either the ID of a group type or aGroupType instance.prop (str) Property name.
- Returns:
None
Service Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
find_service
- find_service(name_or_id, ignore_missing, **query)
Find a single service
- Parameters:
name_or_id The name or ID of a serviceignore_missing (bool) When set to FalseResourceNotFound will be raised whenthe resource does not exist.When set to True, None will be returned when attempting to finda nonexistent resource.query (dict) Additional attributes like host
- Returns:
One: class:~openstack.block_storage.v3.service.Service or None
- Raises:
ResourceNotFoundwhen no resource can be found.
- Raises:
DuplicateResource when multipleresources are found.
services
- services(**query)
Return a generator of service
- Parameters:
query (kwargs) Optional query parameters to be sent to limitthe resources being returned.
- Returns:
A generator of Service objects
- Return type:
class: ~openstack.block_storage.v3.service.Service
enable_service
- enable_service(service)
Enable a service
- Parameters:
service Either the ID of a service or aService instance.
- Returns:
Updated service instance
- Return type:
class: ~openstack.block_storage.v3.service.Service
disable_service
- disable_service(service, reason)
Disable a service
- Parameters:
service Either the ID of a service or aService instancereason (str) The reason to disable a service
- Returns:
Updated service instance
- Return type:
class: ~openstack.block_storage.v3.service.Service
thaw_service
- thaw_service(service)
Thaw a service
- Parameters:
service Either the ID of a service or aService instance
- Returns:
Updated service instance
- Return type:
class: ~openstack.block_storage.v3.service.Service
freeze_service
- freeze_service(service)
Freeze a service
- Parameters:
service Either the ID of a service or aService instance
- Returns:
Updated service instance
- Return type:
class: ~openstack.block_storage.v3.service.Service
failover_service
- failover_service(service, cluster, backend_id)
Failover a service
- Parameters:
service Either the ID of a service or aService instance
- Returns:
Updated service instance
- Return type:
class: ~openstack.block_storage.v3.service.Service
Type Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
get_type
- get_type(type)
Get a single type
- Parameters:
type The value can be the ID of a type or aType instance.
- Returns:
One Type
- Raises:
ResourceNotFoundwhen no resource can be found.
find_type
- find_type(name_or_id, ignore_missing)
Find a single volume type
- Parameters:
snapshot The name or ID a volume typeignore_missing (bool) When set to FalseResourceNotFound will be raisedwhen the volume type does not exist.
- Returns:
One Type
- Raises:
ResourceNotFoundwhen no resource can be found.
- Raises:
DuplicateResource when multipleresources are found.
types
- types(**query)
Retrieve a generator of volume types
- Returns:
A generator of volume type objects.
create_type
- create_type(**attrs)
Create a new type from attributes
- Parameters:
attrs (dict) Keyword arguments which will be used to createa Type,comprised of the properties on the Type class.
- Returns:
The results of type creation
- Return type:
Type
delete_type
- delete_type(type, ignore_missing)
Delete a type
- Parameters:
type The value can be either the ID of a type or aType instance.ignore_missing (bool) When set to FalseResourceNotFound will beraised when the type does not exist.When set to True, no exception will be set whenattempting to delete a nonexistent type.
- Returns:
None
update_type
- update_type(type, **attrs)
Update a type
- Parameters:
type The value can be either the ID of a type or aType instance.attrs (dict) The attributes to update on the type
- Returns:
The updated type
- Return type:
Type
update_type_extra_specs
- update_type_extra_specs(type, **attrs)
Update the extra_specs for a type
- Parameters:
type The value can be either the ID of a type or aType instance.attrs (dict) The extra spec attributes to update on the type
- Returns:
A dict containing updated extra_specs
delete_type_extra_specs
- delete_type_extra_specs(type, keys)
Delete the extra_specs for a type
- Parameters:
type The value can be either the ID of a type or aType instance.keys The keys to delete
- Returns:
None
get_type_access
- get_type_access(type)
Lists project IDs that have access to private volume type.
- Parameters:
type The value can be either the ID of a type or aType instance.
- Returns:
List of dictionaries describing projects that have access tothe specified type
add_type_access
- add_type_access(type, project_id)
Adds private volume type access to a project.
- Parameters:
type The value can be either the ID of a type or aType instance.project_id (str) The ID of the project. Volume Type access tobe added to this project ID.
- Returns:
None
remove_type_access
- remove_type_access(type, project_id)
Remove private volume type access from a project.
- Parameters:
type The value can be either the ID of a type or aType instance.project_id (str) The ID of the project. Volume Type access tobe removed to this project ID.
- Returns:
None
get_type_encryption
- get_type_encryption(volume_type_id)
Get the encryption details of a volume type
- Parameters:
volume_type_id The value can be the ID of a type or aTypeinstance.
- Returns:
One TypeEncryption
- Raises:
ResourceNotFoundwhen no resource can be found.
create_type_encryption
- create_type_encryption(volume_type, **attrs)
Create new type encryption from attributes
- Parameters:
volume_type The value can be the ID of a type or aTypeinstance.attrs (dict) Keyword arguments which will be used to createa TypeEncryption,comprised of the properties on the TypeEncryption class.
- Returns:
The results of type encryption creation
- Return type:
TypeEncryption
delete_type_encryption
- delete_type_encryption(encryption, volume_type, ignore_missing)
Delete type encryption attributes
- Parameters:
encryption The value can be None or aTypeEncryptioninstance. If encryption_id is None thenvolume_type_id must be specified.volume_type The value can be the ID of a type or aTypeinstance. Required if encryption_id is None.ignore_missing (bool) When set to FalseResourceNotFound will beraised when the type does not exist.When set to True, no exception will be set whenattempting to delete a nonexistent type.
- Returns:
None
update_type_encryption
- update_type_encryption(encryption, volume_type, **attrs)
Update a type
- Parameters:
encryption The value can be None or aTypeEncryptioninstance. If this is None then volume_type_id must bespecified.volume_type The value can be the ID of a type or aType instance.Required if encryption_id is None.attrs (dict) The attributes to update on the type encryption.
- Returns:
The updated type encryption
- Return type:
TypeEncryption
Snapshot Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
get_snapshot
- get_snapshot(snapshot)
Get a single snapshot
- Parameters:
snapshot The value can be the ID of a snapshot or aSnapshotinstance.
- Returns:
One Snapshot
- Raises:
ResourceNotFoundwhen no resource can be found.
find_snapshot
- find_snapshot(name_or_id, ignore_missing, details, all_projects)
Find a single snapshot
- Parameters:
snapshot The name or ID a snapshotignore_missing (bool) When set to FalseResourceNotFound will be raisedwhen the snapshot does not exist. When set to True, None willbe returned when attempting to find a nonexistent resource.details (bool) When set to False :class:~openstack.block_storage.v3.snapshot.Snapshot objects will bereturned. The default, True, will cause more attributes to bereturned.all_projects (bool) When set to True, search for snapshot byname across all projects. Note that this will likely result ina higher chance of duplicates. Admin-only by default.
- Returns:
One Snapshot
- Raises:
ResourceNotFoundwhen no resource can be found.
- Raises:
DuplicateResource when multipleresources are found.
snapshots
- snapshots(details, all_projects, **query)
Retrieve a generator of snapshots
- Parameters:
details (bool) When set to False :class:~openstack.block_storage.v3.snapshot.Snapshotobjects will be returned. The default, True, will causemore attributes to be returned.all_projects (bool) When set to True, list snapshots from allprojects. Admin-only by default.query (kwargs) Optional query parameters to be sent to limitthe snapshots being returned. Available parameters include:name: Name of the snapshot as a string.project_id: Filter the snapshots by project.volume_id: volume id of a snapshot.status: Value of the status of the snapshot so that you canfilter on available for example.
- Returns:
A generator of snapshot objects.
create_snapshot
- create_snapshot(**attrs)
Create a new snapshot from attributes
- Parameters:
attrs (dict) Keyword arguments which will be used to createa Snapshot,comprised of the properties on the Snapshot class.
- Returns:
The results of snapshot creation
- Return type:
Snapshot
update_snapshot
- update_snapshot(snapshot, **attrs)
Update a snapshot
- Parameters:
snapshot Either the ID of a snapshot or aSnapshot instance.attrs (dict) The attributes to update on the snapshot.
- Returns:
The updated snapshot
- Return type:
Snapshot
delete_snapshot
- delete_snapshot(snapshot, ignore_missing, force)
Delete a snapshot
- Parameters:
snapshot The value can be either the ID of a snapshot or aSnapshot instance.ignore_missing (bool) When set to FalseResourceNotFound will beraised when the snapshot does not exist.When set to True, no exception will be set whenattempting to delete a nonexistent snapshot.force (bool) Whether to try forcing snapshot deletion.
- Returns:
None
get_snapshot_metadata
- get_snapshot_metadata(snapshot)
Return a dictionary of metadata for a snapshot
- Parameters:
snapshot Either the ID of a snapshot or aSnapshot.
- Returns:
ASnapshot with thesnapshots metadata. All keys and values are Unicode text.
- Return type:
Snapshot
set_snapshot_metadata
- set_snapshot_metadata(snapshot, **metadata)
Update metadata for a snapshot
- Parameters:
snapshot Either the ID of a snapshot or aSnapshot.metadata (kwargs) Key/value pairs to be updated in the snapshotsmetadata. No other metadata is modified by this call. All keysand values are stored as Unicode.
- Returns:
ASnapshot with thesnapshots metadata. All keys and values are Unicode text.
- Return type:
Snapshot
delete_snapshot_metadata
- delete_snapshot_metadata(snapshot, keys)
Delete metadata for a snapshot
- Parameters:
snapshot Either the ID of a snapshot or aSnapshot.keys (list) The keys to delete. If left empty completemetadata will be removed.
- Return type:
None
reset_snapshot
- reset_snapshot(snapshot, status)
Reset status of the snapshot
- Parameters:
snapshot The value can be either the ID of a backup or aSnapshot instance.status (str) New snapshot status
- Returns:
None
set_snapshot_status
- set_snapshot_status(snapshot, status, progress)
Update fields related to the status of a snapshot.
- Parameters:
snapshot The value can be either the ID of a backup or aSnapshot instance.status (str) New snapshot statusprogress (str) A percentage value for snapshot build progress.
- Returns:
None
manage_snapshot
- manage_snapshot(**attrs)
Creates a snapshot by using existing storage rather than
allocating new storage.
- Parameters:
attrs (dict) Keyword arguments which will be used to createa Snapshot,comprised of the properties on the Snapshot class.
- Returns:
The results of snapshot creation
- Return type:
Snapshot
unmanage_snapshot
- unmanage_snapshot(snapshot)
Unmanage a snapshot from block storage provisioning.
- Parameters:
snapshot Either the ID of a snapshot or aSnapshot.
- Returns:
None
Stats Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
backend_pools
- backend_pools(**query)
Returns a generator of cinder Back-end storage pools
- Parameters:
query (kwargs) Optional query parameters to be sent to limitthe resources being returned.
QuotaSet Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
get_quota_set
- get_quota_set(project, usage, **query)
Show QuotaSet information for the project
- Parameters:
project ID or instance ofProject of the project forwhich the quota should be retrievedusage (bool) When set to True quota usage and reservationswould be filled.query (dict) Additional query parameters to use.
- Returns:
One QuotaSet
- Raises:
ResourceNotFoundwhen no resource can be found.
get_quota_set_defaults
- get_quota_set_defaults(project)
Show QuotaSet defaults for the project
- Parameters:
project ID or instance ofProject of the project forwhich the quota should be retrieved
- Returns:
One QuotaSet
- Raises:
ResourceNotFoundwhen no resource can be found.
revert_quota_set
- revert_quota_set(project, **query)
Reset Quota for the project/user.
- Parameters:
project ID or instance ofProject of the project forwhich the quota should be resetted.query (dict) Additional parameters to be used.
- Returns:
None
update_quota_set
- update_quota_set(quota_set, query, **attrs)
Update a QuotaSet.
- Parameters:
quota_set Either the ID of a quota_set or aQuotaSet instance.query (dict) Optional parameters to be used with update call.attrs The attributes to update on the QuotaSet representedby quota_set.
- Returns:
The updated QuotaSet
- Return type:
QuotaSet
Helpers
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
wait_for_status
- wait_for_status(res, status, failures, interval, wait, callback)
Wait for a resource to be in a particular status.
- Parameters:
res The resource to wait on to reach the specified status.The resource must have a status attribute.status (str) Desired status.failures (list) Statuses that would be interpreted as failures.interval Number of seconds to wait before to consecutivechecks. Default to 2.wait Maximum number of seconds to wait before the change.Default to 120.callback A callback function. This will be called with a singlevalue, progress.
- Returns:
The resource is returned on success.
- Raises:
ResourceTimeout if transitionto the desired status failed to occur in specified seconds.
- Raises:
ResourceFailure if the resourcehas transited to one of the failure statuses.
- Raises:
AttributeError if the resource does not have astatus attribute.
wait_for_delete
- wait_for_delete(res, interval, wait, callback)
Wait for a resource to be deleted.
- Parameters:
res The resource to wait on to be deleted.interval (int) Number of seconds to wait before two consecutivechecks. Default to 2.wait (int) Maximum number of seconds to wait before the change.Default to 120.callback A callback function. This will be called with a singlevalue, progress.
- Returns:
The resource is returned on success.
- Raises:
ResourceTimeout if transitionto delete failed to occur in the specified seconds.
BlockStorageSummary Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
summary
- summary(all_projects)
Get Volumes Summary
- Parameters:
all_projects Whether to return the summary of all projectsor not.
- Returns:
One :class:~openstack.block_storage.v3.block_storage_summary.Summaryinstance.
Attachments
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
create_attachment
- create_attachment(volume, **attrs)
Create a new attachment
- Parameters:
volume The value can be either the ID of a volume or aVolume instance.attrs (dict) Keyword arguments which will be used to createa Attachmentcomprised of the properties on the Attachment class likeconnector, instance_id, mode etc.
- Returns:
The results of attachment creation
- Return type:
Attachment
get_attachment
- get_attachment(attachment)
Get a single volume
- Parameters:
attachment The value can be the ID of an attachment or aAttachment instance.
- Returns:
One Attachment
- Raises:
ResourceNotFoundwhen no resource can be found.
attachments
- attachments(**query)
Returns a generator of attachments.
- Parameters:
query (kwargs) Optional query parameters to be sent to limitthe resources being returned.
- Returns:
A generator of attachment objects.
delete_attachment
- delete_attachment(attachment, ignore_missing)
Delete an attachment
- Parameters:
type The value can be either the ID of a attachment or aAttachmentinstance.ignore_missing (bool) When set to FalseResourceNotFound will beraised when the attachment does not exist.When set to True, no exception will be set whenattempting to delete a nonexistent attachment.
- Returns:
None
update_attachment
- update_attachment(attachment, **attrs)
Update an attachment
- Parameters:
attachment The value can be the ID of an attachment or aAttachmentinstance.attrs (dict) Keyword arguments which will be used to updatea Attachmentcomprised of the properties on the Attachment class
- Returns:
The updated attachment
- Return type:
Attachment
complete_attachment
- complete_attachment(attachment)
Complete an attachment
- Parameters:
attachment The value can be the ID of an attachment or aAttachmentinstance.
- Returns:
None
- Return type:
Attachment
Transfer Operations
openstack.block_storage.v3._proxy.Proxy(session, statsd_client, statsd_prefix, prometheus_counter, prometheus_histogram, influxdb_config, influxdb_client, *args, **kwargs)
create_transfer
- 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 transferattrs (dict) Keyword arguments which will be used to createa Transfercomprised of the properties on the Transfer class.
- Returns:
The results of Transfer creation
- Return type:
Transfer
delete_transfer
- delete_transfer(transfer, ignore_missing)
Delete a volume transfer
- Parameters:
transfer The value can be either the ID of a transfer or aTransfer` instance.ignore_missing (bool) When set to FalseResourceNotFound will beraised when the transfer does not exist.When set to True, no exception will be set whenattempting to delete a nonexistent transfer.
- Returns:
None
find_transfer
- find_transfer(name_or_id, ignore_missing)
Find a single transfer
- Parameters:
name_or_id The name or ID a transferignore_missing (bool) When set to FalseResourceNotFound will be raisedwhen the volume transfer does not exist.
- Returns:
One Transfer
- Raises:
ResourceNotFoundwhen no resource can be found.
- Raises:
DuplicateResource when multipleresources are found.
get_transfer
- get_transfer(transfer)
Get a single transfer
- Parameters:
transfer The value can be the ID of a transfer or aTransferinstance.
- Returns:
One Transfer
- Raises:
ResourceNotFoundwhen no resource can be found.
transfers
- transfers(details, all_projects, **query)
Retrieve a generator of transfers
- Parameters:
details (bool) When set to False no extended attributeswill be returned. The default, True, will cause objects withadditional attributes to be returned.all_projects (bool) When set to True, list transfers fromall projects. Admin-only by default.query (kwargs) Optional query parameters to be sent to limitthe transfers being returned.
- Returns:
A generator of transfer objects.
accept_transfer
- accept_transfer(transfer_id, auth_key)
Accept a Transfer
- Parameters:
transfer_id The value can be the ID of a transfer or aTransferinstance.auth_key The key to authenticate volume transfer.
- Returns:
The results of Transfer creation
- Return type:
Transfer