openstack.block_storage.v3.volume¶
The Volume Class¶
The Volume
class inherits from Resource
.
- class openstack.block_storage.v3.volume.Volume(_synchronized=False, connection=None, **attrs)¶
The base resource
- Parameters:
_synchronized (bool) – This is not intended to be used directly. See
new()
andexisting()
.connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of
self._connection
in Resource code should protect itself with a check for None.
- resource_key = 'volume'¶
Singular form of key for resource.
- resources_key = 'volumes'¶
Plural form of key for resource.
- base_path = '/volumes'¶
The base part of the URI for this resource.
- allow_fetch = True¶
Allow get operation for this resource.
- allow_create = True¶
Allow create operation for this resource.
- allow_delete = True¶
Allow delete operation for this resource.
- allow_commit = True¶
Allow update operation for this resource.
- allow_list = True¶
Allow list operation for this resource.
- attachments¶
Instance attachment information. If this volume is attached to a server instance, the attachments list includes the UUID of the attached server, an attachment UUID, the name of the attached host, if any, the volume UUID, the device, and the device UUID. Otherwise, this list is empty.
- availability_zone¶
The availability zone.
- consistency_group_id¶
ID of the consistency group.
- consumes_quota¶
Whether this resource consumes quota or not. Resources that not counted for quota usage are usually temporary internal resources created to perform an operation. (since 3.65)
- cluster_name¶
The cluster name of volume backend. (since 3.61)
- created_at¶
The timestamp of this volume creation.
- description¶
The volume description.
- encryption_key_id¶
The UUID of the encryption key. Only included for encrypted volumes. (since 3.64)
- extended_replication_status¶
Extended replication status on this volume.
- group_id¶
The ID of the group that the volume belongs to. (since 3.13)
- host¶
The volume’s current back-end.
- image_id¶
The ID of the image from which you want to create the volume. Required to create a bootable volume.
- is_bootable¶
Enables or disables the bootable attribute. You can boot an instance from a bootable volume. Type: bool
- is_encrypted¶
True
if this volume is encrypted,False
if not. Type: bool
- is_multiattach¶
Whether volume will be sharable or not.
- migration_id¶
The volume ID that this volume’s name on the back-end is based on.
- migration_status¶
The status of this volume’s migration (None means that a migration is not currently in progress).
- project_id¶
The project ID associated with current back-end.
- replication_driver_data¶
Data set by the replication driver
- provider_id¶
The provider ID for the volume. (since 3.21)
- replication_status¶
Status of replication on this volume.
- scheduler_hints¶
Scheduler hints for the volume
- service_uuid¶
A unique identifier that’s used to indicate what node the volume-service for a particular volume is being serviced by. (since 3.48)
An indicator whether the host connecting the volume should lock for the whole attach/detach process or not. true means only is iSCSI initiator running on host doesn’t support manual scans, false means never use locks, and null means to always use locks. Look at os-brick’s guard_connection context manager. Default=True. (since 3.48)
- size¶
The size of the volume, in GBs.
- snapshot_id¶
To create a volume from an existing snapshot, specify the ID of the existing volume snapshot. If specified, the volume is created in same availability zone and with same size of the snapshot.
- source_volume_id¶
To create a volume from an existing volume, specify the ID of the existing volume. If specified, the volume is created with same size of the source volume.
- status¶
One of the following values: creating, available, attaching, in-use deleting, error, error_deleting, backing-up, restoring-backup, error_restoring. For details on these statuses, see the Block Storage API documentation.
- updated_at¶
The date and time when the resource was updated.
- user_id¶
The user ID associated with the volume
- volume_image_metadata¶
One or more metadata key and value pairs about image
- volume_type¶
The name of the associated volume type.
- volume_type_id¶
The associated volume type ID for the volume. (since 3.61)
- extend(session, size)¶
Extend a volume size.
- complete_extend(session, error=False)¶
Complete volume extend operation
- set_bootable_status(session, bootable=True)¶
Set volume bootable status flag
- set_readonly(session, readonly)¶
Set volume readonly flag
- set_image_metadata(session, metadata)¶
Sets image metadata key-value pairs on the volume
- delete_image_metadata(session)¶
Remove all image metadata from the volume
- delete_image_metadata_item(session, key)¶
Remove a single image metadata from the volume
- reset_status(session, status=None, attach_status=None, migration_status=None)¶
Reset volume statuses (admin operation)
- revert_to_snapshot(session, snapshot_id)¶
Revert volume to its snapshot
- attach(session, mountpoint, instance=None, host_name=None)¶
Attach volume to server
- detach(session, attachment, force=False, connector=None)¶
Detach volume from server
- classmethod manage(session, host, ref, name=None, description=None, volume_type=None, availability_zone=None, metadata=None, bootable=False, cluster=None)¶
Manage an existing volume.
- unmanage(session)¶
Unmanage volume
- retype(session, new_type, migration_policy=None)¶
Change volume type
- migrate(session, host=None, force_host_copy=False, lock_volume=False, cluster=None)¶
Migrate volume
- complete_migration(session, new_volume_id, error=False)¶
Complete volume migration
- force_delete(session)¶
Force volume deletion
- upload_to_image(session, image_name, force=False, disk_format=None, container_format=None, visibility=None, protected=None)¶
Upload the volume to image service
- reserve(session)¶
Reserve volume
- unreserve(session)¶
Unreserve volume
- begin_detaching(session)¶
Update volume status to ‘detaching’
- abort_detaching(session)¶
Roll back volume status to ‘in-use’
- init_attachment(session, connector)¶
Initialize volume attachment
- terminate_attachment(session, connector)¶
Terminate volume attachment