Volumes
1. volumes()
get the list of volumes or a specified volume
Parameters:
| Name | Type | Description |
|---|---|---|
| id | string | if specified, you will get exactly one object of Volume |
Return value: List Of Volume Instance
Return value example:
istack/volumev2/v2/Volume Volume
id : dfa903aa-e9f4-4e67-905f-4e18197d816a
links : [{u'href': u'http://10.200.43.31:8776/v2/cde9cbf5a7f1401a9389c84ba98bdcf6/volumes/dfa903aa-e9f4-4e67-905f-4e18197d816a', u'rel': u'self'}, {u'href': u'http://10.200.43.31:8776/cde9cbf5a7f1401a9389c84ba98bdcf6/volumes/dfa903aa-e9f4-4e67-905f-4e18197d816a', u'rel': u'bookmark'}]
name : New Volume python test
2. create_volume(**attrs)
create a volume with given attributes
Parameters:
| Name | Type | Description |
|---|---|---|
| size | int | The size of the volume, in gibibytes (GiB). |
| availability_zone (Optional) | string | The availability zone. |
| source_volid (Optional) | UUID | The UUID of the source volume. The API creates a new volume with the same size as the source volume. |
| description (Optional) | string | The volume description. |
| multiattach (Optional) | boolean | To enable this volume to attach to more than one server, set this value to true. Default is false. |
| snapshot_id (Optional) | UUID | To create a volume from an existing snapshot, specify the UUID of the volume snapshot. The volume is created in same availability zone and with same size as the snapshot. |
| name (Optional) | string | The volume name. |
| imageRef (Optional) | UUID | The UUID of the image from which you want to create the volume. Required to create a bootable volume. |
| volume_type (Optional) | string | The volume type. To create an environment with multiple-storage back ends, you must specify a volume type. Block Storage volume back ends are spawned as children to cinder-volume, and they are keyed from a unique queue. They are named cinder- volume.HOST.BACKEND. For example,cinder- volume.ubuntu.lvmdriver. When a volume is created, the scheduler chooses an appropriate back end to handle the request based on the volume type. Default is None. For information about how to use volume types to create multiple-storage back ends, see Configure multiple-storage back ends. |
| metadata (Optional) | dict | One or more metadata key and value pairs that are associated with the volume. |
| source_replica (Optional) | UUID | The UUID of the primary volume to clone. |
| consistencygroup_id (Optional) | UUID | The UUID of the consistency group. |
| scheduler_hints (Optional) | dict | The dictionary of data to send to the scheduler. |
Parameters example:
self.cloud.volumev2.create_volume(size=10)
Return value:
Return value example:
istack/volumev2/v2/Volume Volume
id : dfa903aa-e9f4-4e67-905f-4e18197d816a
links : [{u'href': u'http://10.200.43.31:8776/v2/cde9cbf5a7f1401a9389c84ba98bdcf6/volumes/dfa903aa-e9f4-4e67-905f-4e18197d816a', u'rel': u'self'}, {u'href': u'http://10.200.43.31:8776/cde9cbf5a7f1401a9389c84ba98bdcf6/volumes/dfa903aa-e9f4-4e67-905f-4e18197d816a', u'rel': u'bookmark'}]
name : New Volume python test
3. update_volume(volume, **attrs)
update volume with given attributes
Parameters:
| Name | Type | Description |
|---|---|---|
| name (Optional) | string | The volume name. |
| description (Optional) | string | The volume description. |
| metadata (Optional) | dict | One or more metadata key and value pairs that are associated with the volume. |
Return value:
Return value example:
istack/volumev2/v2/Volume Volume
id : dfa903aa-e9f4-4e67-905f-4e18197d816a
links : [{u'href': u'http://10.200.43.31:8776/v2/cde9cbf5a7f1401a9389c84ba98bdcf6/volumes/dfa903aa-e9f4-4e67-905f-4e18197d816a', u'rel': u'self'}, {u'href': u'http://10.200.43.31:8776/cde9cbf5a7f1401a9389c84ba98bdcf6/volumes/dfa903aa-e9f4-4e67-905f-4e18197d816a', u'rel': u'bookmark'}]
name : New Volume python test
4. delete_volume(volume)
delete volume with given attributes
Parameters:
| Name | Type | Description |
|---|---|---|
| id | string(inside volume param) | id must be at least specified in the parameter instance volume |
Return value: None
5. volume_metadata(volume_id)
Get the volume metadata
Parameters:
| Name | Type | Description |
|---|---|---|
| volume_id | string | the id of the volume |
Return value: Dict
Return value example:
{u'name': u'pythonTest'}
6. update_volume_metadata(volume_id, **attrs)
update the volume metadata
Parameters:
| Name | Type | Description |
|---|---|---|
| name(optional) | string | inside the attributes part |
| volume_id | string | the id of the target volume |
Parameters example:
cloud.volumev2.update_volume_metadata(volume[‘id’], name=’newPythonWorld’)
Return value: Dict
Return value example:
{u'name': u'pythonTest'}