API: Volumes
The volume category allows you to create and manage block storage volumes.
Action | Required Parameters | Optional Parameters |
---|---|---|
volume/create | region, label, size | image, snapshot_id |
volume/list | None | None |
volume/info | volume_id | None |
volume/attach | volume_id, vm_id, target | None |
volume/detach | volume_id | None |
volume/extend | volume_id, size | None |
volume/rename | volume_id, name | None |
volume/delete | volume_id | None |
volume/snapshot-create | volume_id, label | None |
volume/snapshot-list | region | None |
volume/snapshot-replicate | region, snapshot_id, image_name, dst_region | None |
volume/snapshot-delete | region, snapshot_id | None |
volume/create
Required parameters:
- region - region ('toronto', 'montreal', 'roubaix')
- label - a label for this volume
- size - size to allocate in GB
Optional parameters:
- image - an image ID (see image/list)
- snapshot_id - a volume snapshot ID (see volume/snapshot-list)
Notes
- image specifies an image ID, which may be a snapshot of a VM, while snapshot_id specifies the ID of a volume snapshot. If neither is set, an empty volume is created.
Endpoint: volume/create region=toronto label=myvolume size=100 { "success": "yes", "volume_id": "4682" }
volume/list
List all volumes on your account. Optionally set region to filter for volumes in a specific region.
Optional parameters:
- region - region ('toronto', 'montreal', 'roubaix')
Endpoint: volume/list { "success": "yes", "volumes": [ { "id": "4682", "identification": "8b48723c-f53a-4717-9f04-fa194869db18", "name": "myvolume", "region": "toronto", "size": "100", "status": "active", "time_created": "2018-12-17T01:00:15Z", "user_id": "36" } ] }
volume/info
Required parameters:
- volume_id - the volume ID
Endpoint: volume/info volume_id=4682 { "success": "yes", "volume": { "attached": "", "created": "2018-12-17T01:00:15Z", "id": "4682", "identification": "8b48723c-f53a-4717-9f04-fa194869db18", "name": "myvolume", "size": "100", "status": "available" } }
Response notes:
- If the volume is attached to a VM, attached will contain the VM UUID and status will be 'in-use'.
volume/attach
Attach the volume to an existing VM.
Required parameters:
- volume_id - the volume ID
- vm_id - the VM UUID
- target - a target device: '/dev/vda' for virtio or '/dev/hda' for ide
Endpoint: volume/attach volume_id=4682 vm_id=16b64847-0a86-42ea-bea8-ed60bd960c68 target=auto {"success": "yes"}
volume/detach
Required parameters:
- volume_id - the volume ID
Endpoint: volume/detach volume_id=4682 {"success": "yes"}
volume/extend
Extend the size of an unattached volume.
Required parameters:
- volume_id - the volume ID
- size - the new size in GB
Endpoint: volume/extend volume_id=4682 size=150 {"success": "yes"}
volume/rename
Required parameters:
- volume_id - the volume ID
- name - the new name
Endpoint: volume/rename volume_id=4682 name=myvolume2 {"success": "yes"}
volume/delete
Required parameters:
- volume_id - the volume ID
Endpoint: volume/delete volume_id=4682 {"success": "yes"}
volume/snapshot-create
Take a snapshot of a volume. Note that this produces a volume snapshot, not an image.
Required parameters:
- volume_id - the volume ID to snapshot
- label - a label for this volume snapshot
Endpoint: volume/snapshot-create volume_id=4682 label=myvolsnapshot { "snapshot_id": "484a06d3-7ea6-40d6-8e72-9e7e23f6826b", "success": "yes" }
volume/snapshot-list
Required parameters:
- region - region ('toronto', 'montreal', 'roubaix')
Endpoint: volume/snapshot-list region=toronto { "snapshots": [ { "id": "484a06d3-7ea6-40d6-8e72-9e7e23f6826b", "name": "myvolsnapshot", "region": "toronto", "size": "150", "status": "available", "user_id": "36", "volume": { "id": "4682", "identification": "8b48723c-f53a-4717-9f04-fa194869db18", "name": "myvolume", "region": "toronto", "size": "150", "status": "active", "time_created": "2018-12-17T01:00:15Z", "user_id": "36" } } ], "success": "yes" }
volume/snapshot-replicate
Create an image from a volume snapshot, either in the same region or another region
Required parameters:
- region - region of the source volume snapshot ('toronto', 'montreal', 'roubaix')
- snapshot_id - the volume snapshot UUID
- image_name - a label for the image
- dst_region - destination region ('toronto', 'montreal', 'roubaix')
Endpoint: volume/snapshot-replicate region=toronto snapshot_id=484a06d3-7ea6-40d6-8e72-9e7e23f6826b image_name=ImageFromVolSnapshot dst_region=toronto { "image_id": "141129", "success": "yes" }
volume/snapshot-delete
Required parameters:
- region - region of the volume snapshot ('toronto', 'montreal', 'roubaix')
- snapshot_id - the volume snapshot UUID
Endpoint: volume/snapshot-delete region=toronto snapshot_id=484a06d3-7ea6-40d6-8e72-9e7e23f6826b {"success": "yes"}