Persistent Storage provides on-site management of persistent storage areas (a la Amazon Elastic Block Store) allowing users to create disks of a given size, to launch a machine with the disks attached, and to persist the disks after their use, so that the disks are available for use by another machine instance.
The persistent disk API provide a simple way to interact with it in programs. The API URLs starts with /api/ and has no ending slash.
List disks properties available for a user.
GET /api/disks
Status: 200 OK
[
{
"users": "0",
"created": "2011/07/28 15:01:40",
"visibility": "private",
"tag": "a simple disk",
"owner": "test",
"uuid": "eb198dec-3560-4a9a-b3b4-5f043410a3dd",
"size": "2"
},
{
"users": "0",
"created": "2011/07/28 15:01:54",
"visibility": "public",
"tag": "a public disk",
"owner": "test",
"uuid": "7d409aed-3207-4dd1-85f3-3bca3605b1fb",
"size": "1"
}
]
GET /api/disks/:uuid
Status: 200 OK
X-DiskUser-Limit: 2
X-DiskUser-Remaining: 1
{
"users": "1",
"created": "2011/07/28 15:01:40",
"visibility": "private",
"tag": "a simple disk",
"owner": "test",
"uuid": "eb198dec-3560-4a9a-b3b4-5f043410a3dd",
"size": "2"
}
Disk user limit and disk user remaining for a disk are send in the HTTP headers as X-DiskUser-Limit and X-DiskUser-Remaining. Client should not try to attach a disk which as less than one remaining disk user.
DELETE /api/disks/:uuid
Status: 200 OK
{ "uuid": "eb198dec-3560-4a9a-b3b4-5f043410a3dd" }
POST /api/create
private or public.All of the inputs are required.
Status: 201 Created
{ "uuid": "a00539f7-d40d-4d8d-95c0-5b0c9713c92e" }
The returned content is the UUID of the newly created persistent disk.
POST /api/hotattach/:uuid
Status: 200 OK
{
"node": "onehost-2.lal.in2p3.fr",
"vm_id": "722",
"target": "vda",
"uuid": ["a00539f7-d40d-4d8d-95c0-5b0c9713c92e", "eb198dec-3560-4a9a-b3b4-5f043410a3dd"]
}
The returned UUIDs are all the disk that are attached to the VM.
POST /api/hotdetach/:uuid
Only hot-plugged disk can be detached with this method.
Status: 200 OK
{
"node": "onehost-2.lal.in2p3.fr",
"vm_id": "722",
"target": "vda",
"uuid": ["a00539f7-d40d-4d8d-95c0-5b0c9713c92e", "eb198dec-3560-4a9a-b3b4-5f043410a3dd"]
}
The returned UUIDs are the remaining attached disks on the VM.
This method is intended to be used by the cloud frontend.
POST /api/attach/:uuid
This method will not check disk availability, it have to be done by the client before launching a VM.
Disk attached this way can only be removed when the VM is killed.
Status: 200 OK
{
"node": "onehost-2.lal.in2p3.fr",
"vm_id": "722",
"uuid": ["a00539f7-d40d-4d8d-95c0-5b0c9713c92e", "eb198dec-3560-4a9a-b3b4-5f043410a3dd"]
}
The returned UUIDs are all the disk that are attached to the VM.
This method is intended to be used by the cloud frontend.
POST /api/detach
This method should be called only when the VM is killed.
Status: 200 OK
{
"node": "onehost-2.lal.in2p3.fr",
"vm_id": "722",
"uuid": ["a00539f7-d40d-4d8d-95c0-5b0c9713c92e", "eb198dec-3560-4a9a-b3b4-5f043410a3dd"]
}
The returned UUIDs are all the disk that have been detached from the VM.
Client error on API calls are returned with either a 400 Bad Request or a 422 Unprocessable Entity response.
Error messages as structured as follows:
{"message": ["First error message", "Second error message"] }