For details on how to use block_storage, see Using OpenStack Block Storage
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.
Get a single volume
volume – The value can be the ID of a volume or a
Volume
instance.
One Volume
NotFoundException
when no resource can be found.
Find a single volume
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.
One Volume
or
None.
NotFoundException
when no resource can be found.
DuplicateResource
when multiple
resources are found.
Retrieve a generator of volumes
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.
A generator of volume objects.
Create a new volume from attributes
Delete a volume
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.
None
Extend a volume
volume – The value can be either the ID of a volume or a
Volume
instance.
size – New volume size
None
Retype the volume.
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.
None
Set bootable status of the volume.
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.
None
Update image metadata for a volume
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.
None
Delete metadata for a volume
volume – Either the ID of a volume or a
Volume
.
keys (list) – The keys to delete. If left empty complete metadata will be removed.
None
Reset volume statuses.
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).
None
Attaches a volume to a server.
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.
None
Detaches a volume from a server.
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.
None
back-end storage object that is associated with it.
volume – The value can be either the ID of a volume or a
Volume
instance.
None
Migrates a volume to the specified host.
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.
None
Complete the migration of a volume.
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.
None
Return a dictionary of metadata for a volume
Update metadata for a volume
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.
A Volume
with the
volume’s metadata. All keys and values are Unicode text.
Delete metadata for a volume
volume – Either the ID of a volume or a
Volume
.
keys (list) – The keys to delete. If left empty complete metadata will be removed.
None
Retrieve a generator of backups
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.
A generator of backup objects.
Get a backup
Create a new Backup from attributes with native API
Delete a CloudBackup
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
None
Restore a Backup to volume
Get a backend’s capabilites
host – Specified backend to obtain volume stats and properties.
One :class: ~openstack.block_storage.v2.capabilites.Capabilities instance.
NotFoundException
when no
resource can be found.
Retrieves limits
project – A project to get limits for. The value can be either
the ID of a project or an
Project
instance.
A Limits object, including both
AbsoluteLimit
and
RateLimit
Get a single type
type – The value can be the ID of a type or a
Type
instance.
One Type
NotFoundException
when no resource can be found.
Retrieve a generator of volume types
A generator of volume type objects.
Create a new type from attributes
Delete a type
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.
None
Get a single snapshot
snapshot – The value can be the ID of a snapshot or a
Snapshot
instance.
One Snapshot
NotFoundException
when no resource can be found.
Retrieve a generator of snapshots
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.
A generator of snapshot objects.
Create a new snapshot from attributes
Delete a snapshot
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.
None
Returns a generator of cinder Back-end storage pools
query (kwargs) – Optional query parameters to be sent to limit the resources being returned.
:returns A generator of cinder Back-end storage pools objects
Get a single quota class set
Only one quota class is permitted, default
.
quota_class_set – The value can be the ID of a quota class set
(only default
is supported) or a
QuotaClassSet
instance.
One
QuotaClassSet
NotFoundException
when no resource can be found.
Update a QuotaClassSet.
Only one quota class is permitted, default
.
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
.
The updated QuotaSet
Show QuotaSet information for the project
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.
One QuotaSet
NotFoundException
when no resource can be found.
Show QuotaSet defaults for the project
project – ID or instance of
Project
of the project for
which the quota should be retrieved
One QuotaSet
NotFoundException
when no resource can be found.
Reset Quota for the project/user.
project – ID or instance of
Project
of the project for
which the quota should be resetted.
query (dict) – Additional parameters to be used.
None
Update a QuotaSet.
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
.
The updated QuotaSet
Wait for a resource to be in a particular status.
res – The resource to wait on to reach the specified status.
The resource must have a status
attribute.
status – Desired status.
failures (list
) – Statuses that would be interpreted as failures.
interval – Number of seconds to wait before to consecutive checks. 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 single value, progress.
The resource is returned on success.
ResourceTimeout
if transition
to the desired status failed to occur in specified seconds.
ResourceFailure
if the resource
has transited to one of the failure statuses.
AttributeError
if the resource does not have a
status
attribute.
Wait for a resource to be deleted.
res – The resource to wait on to be deleted.
interval – Number of seconds to wait before to consecutive checks. 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 single value, progress.
The resource is returned on success.
ResourceTimeout
if transition
to delete failed to occur in the specified seconds.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.