How to Bytemark

Discs

Each virtual machine can have up to 8 discs attached — the discs API allows you to add, remove, expand and delete discs. You can find a more complete explanation of discs here.

Endpoints

These are relative to https://uk0.bigv.io

GET /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs
GET /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs/{disc-id}
POST /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs
PUT /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs/{disc-id}
DELETE /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs/{disc-id}?purge=true

# Non-nested endpoints (currently only GET)
GET /discs
GET /discs?vm_id={vm-id}
GET /discs/{disc-id}
  • Replace {account-id} with the account id or name.
  • Replace {group-id} with the group id or name (or default if you don’t use groups!).
  • Replace {vm-id} with the id of the virtual machine.
  • Replace {disc-id} with the disc id.

There is (currently) no ability to delete a disc through the API; discs must be purged (which ensures that the data is removed). With the DELETE method, you currently need to supply a purge=true parameter, otherwise the call will fail with a 500 error.


Attributes

  • id – unique key (integer).
  • label – Unix device label — this can be any string to identify the drive.
  • size – size in megabytes.
  • storage_grade – device type: SATA or archive.
  • virtual_machine_id – id of the VM it’s attached to.
  • storage_pool – type type of storage being used (see definitions).

The only restriction on label is you cannot use a label that looks like a Unix device name. This can potentially be confusing if discs are later moved around inside the guest. So you can use any string except vda, sda, or hda (and subsequent letters, vdb etc).


Examples

All Discs on a virtual machine

Request
GET /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs

# New style
GET /discs?vm_id={vm-id}
Curl
curl -H "Content-type: application/json" \
     -H "Authorization: Bearer {session-id}" \
     https://uk0.bigv.io/accounts/myaccountname/groups/default/virtual_machines/1234/discs
Response (success: 200)
[
  {
    "id": 1111,
    "label": "root",
    "size": 25600,
    "virtual_machine_id": 1234,
    "storage_pool": "tail1-sata1",
    "storage_grade": "sata"
  }
]

Single Disc

Request
GET /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs/{disc-id}

# New style
GET /discs/{disc-id}
Curl:
curl -H "Content-type: application/json" \
     -H "Authorization: Bearer {session-id}" \
     https://uk0.bigv.io/accounts/myaccountname/groups/default/virtual_machines/1234/discs
Response (success: 200)
{
  "id": 1111,
  "label": "root",
  "size": 25600,
  "virtual_machine_id": 1234,
  "storage_pool": "tail1-sata1",
  "storage_grade": "sata"
}

Create New Disc

Request
POST /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs
Curl
curl -H "Content-type: application/json" \
     -H "Authorization: Bearer {session-id}" \
     -X POST \
     -d '{"label":"backups","size":10240,"storage_grade":"archive"}' \
     https://uk0.bigv.io/accounts/myaccountname/groups/default/virtual_machines/45/discs
Response (success: 200)
{
  "id": 46,
  "label": "backups",
  "size": 10240,
  "virtual_machine_id": 45,
  "storage_pool": "t1-archive1",
  "storage_grade": "archive"
}

Update Disc

Request
PUT /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs/{disc-id}
Curl
curl -H "Content-type: application/json" \
     -H "Authorization: Bearer {session-id}" \
     -X PUT \
     -d '{"label":"oldbackups"}' \
     https://uk0.bigv.io/accounts/myaccountname/groups/default/virtual_machines/45/discs/46
Response (success: 200)
{
  "id": 46,
  "label": "oldbackups",
  "size": 10240,
  "virtual_machine_id": 45,
  "storage_pool": "t1-archive1",
  "storage_grade": "archive"
}

Purge Disc

Request
DELETE /accounts/{account-id}/groups/{group-id}/virtual_machines/{vm-id}/discs/{disc-id}?purge=true
Curl
curl -H "Content-type: application/json" \
     -H "Authorization: Bearer {session-id}" \
     -X DELETE \
     https://uk0.bigv.io/accounts/myaccountname/groups/default/virtual_machines/45/discs/46?purge=true
Response (success: 204)
Bytemark Cloud used to be called "BigV"—nothing has changed except the name! We’re hiring! Please visit careers.bytemark.co.uk to find out more.