Volume interface (v2 extension).
-
class cinderclient.v2.volumes.Volume(manager, info, loaded=False)
Bases: cinderclient.base.Resource
A volume is an extra block level storage to the OpenStack instances.
-
attach(instance_uuid, mountpoint)
Set attachment metadata.
| Parameters: |
- instance_uuid – uuid of the attaching instance.
- mountpoint – mountpoint on the attaching instance.
|
-
begin_detaching(volume)
Begin detaching volume.
-
delete()
Delete this volume.
-
detach()
Clear attachment metadata.
-
force_delete()
Delete the specififed volume ignoring it’s current state.
| Parameters: | volume – The UUID of the volume to force-delete. |
-
initialize_connection(volume, connector)
Initialize a volume connection.
| Parameters: | connector – connector dict from nova. |
-
reserve(volume)
Reserve this volume.
-
roll_detaching(volume)
Roll detaching volume.
-
set_metadata(volume, metadata)
Set or Append metadata to a volume.
:param type : The :class: Volume to set metadata on
:param metadata: A dict of key/value pairs to set
-
terminate_connection(volume, connector)
Terminate a volume connection.
| Parameters: | connector – connector dict from nova. |
-
unreserve(volume)
Unreserve this volume.
-
update(**kwargs)
Update the name or description for this volume.
-
upload_to_image(force, image_name, container_format, disk_format)
Upload a volume to image service as an image.
-
class cinderclient.v2.volumes.VolumeManager(api)
Bases: cinderclient.base.ManagerWithFind
Manage Volume resources.
-
attach(volume, instance_uuid, mountpoint)
Set attachment metadata.
| Parameters: |
- volume – The Volume (or its ID)
you would like to attach.
- instance_uuid – uuid of the attaching instance.
- mountpoint – mountpoint on the attaching instance.
|
-
begin_detaching(volume)
Begin detaching this volume.
| Parameters: | volume – The Volume (or its ID)
you would like to detach. |
-
create(size, snapshot_id=None, source_volid=None, name=None, description=None, volume_type=None, user_id=None, project_id=None, availability_zone=None, metadata=None, imageRef=None)
Create a volume.
| Parameters: |
- size – Size of volume in GB
- snapshot_id – ID of the snapshot
- name – Name of the volume
- description – Description of the volume
- volume_type – Type of volume
- user_id – User id derived from context
- project_id – Project id derived from context
- availability_zone – Availability Zone to use
- metadata – Optional metadata to set on volume creation
- imageRef – reference to an image stored in glance
- source_volid – ID of source volume to clone from
|
| Return type: | Volume
|
-
delete(volume)
Delete a volume.
| Parameters: | volume – The Volume to delete. |
-
delete_metadata(volume, keys)
Delete specified keys from volumes metadata.
| Parameters: |
- volume – The Volume.
- metadata – A list of keys to be removed.
|
-
detach(volume)
Clear attachment metadata.
| Parameters: | volume – The Volume (or its ID)
you would like to detach. |
-
force_delete(volume)
-
get(volume_id)
Get a volume.
| Parameters: | volume_id – The ID of the volume to delete. |
| Return type: | Volume |
-
initialize_connection(volume, connector)
Initialize a volume connection.
| Parameters: |
- volume – The Volume (or its ID).
- connector – connector dict from nova.
|
-
list(detailed=True, search_opts=None)
Get a list of all volumes.
-
reserve(volume)
Reserve this volume.
| Parameters: | volume – The Volume (or its ID)
you would like to reserve. |
-
resource_class
alias of Volume
-
roll_detaching(volume)
Roll detaching this volume.
| Parameters: | volume – The Volume (or its ID)
you would like to roll detaching. |
-
set_metadata(volume, metadata)
Update/Set a volumes metadata.
| Parameters: |
- volume – The Volume.
- metadata – A list of keys to be set.
|
-
terminate_connection(volume, connector)
Terminate a volume connection.
| Parameters: |
- volume – The Volume (or its ID).
- connector – connector dict from nova.
|
-
unreserve(volume)
Unreserve this volume.
| Parameters: | volume – The Volume (or its ID)
you would like to unreserve. |
-
update(volume, **kwargs)
Update the name or description for a volume.
| Parameters: | volume – The Volume to delete. |
-
upload_to_image(volume, force, image_name, container_format, disk_format)
Upload volume to image service as image.
| Parameters: | volume – The Volume to upload. |