Block Store API¶
For details on how to use block_store, see Using OpenStack Block Store
The BlockStore Class¶
The block_store high-level interface is available through the block_store
member of a Connection object.
The block_store member will only be added if the service is detected.
Volume Operations¶
-
class
openstack.block_store.v2._proxy.Proxy(session)¶ -
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)¶ Delete a volume
Parameters: - volume – The value can be either the ID of a volume or a
Volumeinstance. - ignore_missing (bool) – When set to
FalseResourceNotFoundwill be raised when the volume does not exist. When set toTrue, no exception will be set when attempting to delete a nonexistent volume.
Returns: None- volume – The value can be either the ID of a volume or a
-
get_volume(volume)¶ Get a single volume
Parameters: volume – The value can be the ID of a volume or a Volumeinstance.Returns: One VolumeRaises: ResourceNotFoundwhen no resource can be found.
-
volumes(details=True, **query)¶ Retrieve a generator of volumes
Parameters: - details (bool) – When set to
FalseVolumeobjects will be returned. The default,True, will causeVolumeDetailobjects to be returned. - **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.
- all_tenants: Whether return the volumes of all tenants
- status: Value of the status of the volume so that you can filter
- on “available” for example.
Returns: A generator of volume objects.
- details (bool) – When set to
-
Type Operations¶
-
class
openstack.block_store.v2._proxy.Proxy(session) -
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
Typeinstance. - ignore_missing (bool) – When set to
FalseResourceNotFoundwill be raised when the type does not exist. When set toTrue, no exception will be set when attempting to delete a nonexistent type.
Returns: None- type – The value can be either the ID of a type or a
-
get_type(type)¶ Get a single type
Parameters: type – The value can be the ID of a type or a Typeinstance.Returns: One TypeRaises: ResourceNotFoundwhen no resource can be found.
-
types()¶ Retrieve a generator of volume types
Returns: A generator of volume type objects.
-
Snapshot Operations¶
-
class
openstack.block_store.v2._proxy.Proxy(session) -
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
Snapshotinstance. - ignore_missing (bool) – When set to
FalseResourceNotFoundwill be raised when the snapshot does not exist. When set toTrue, no exception will be set when attempting to delete a nonexistent snapshot.
Returns: None- snapshot – The value can be either the ID of a snapshot or a
-
get_snapshot(snapshot)¶ Get a single snapshot
Parameters: snapshot – The value can be the ID of a snapshot or a Snapshotinstance.Returns: One SnapshotRaises: ResourceNotFoundwhen no resource can be found.
-
snapshots(details=True, **query)¶ Retrieve a generator of snapshots
Parameters: - details (bool) – When set to
FalseSnapshotobjects will be returned. The default,True, will causeSnapshotDetailobjects to be returned. - **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.
- all_tenants: Whether return the snapshots of all tenants.
- 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.
- details (bool) – When set to
-