Attach a volume to VM.
This API can be executed only when the specific VN is not running.

Cannot be attached if already attached a volume to the VM.

Request URL

Compute API v2.0

POST /v2/​{tenant_id}​/servers/​{server_id}​/os-volume_attachments

Request Paramters

Parameter Value Style Description
X-Auth-Token User Token header
tenant_id Tenant ID URI
server_id Server ID URI
volumeId Volume ID plain
device (Optional) plain Apply a device is not running at the moment when you don't specify any(vdb,vdc,vdd…).

Request Json

    "volumeAttachment": {
        "volumeId": "a23d28e1-24f5-470b-af03-f067993879c0",
        "device": "/dev/vdd"

Normal response codes

200 OK


curl -i -X POST \
-H "Accept: application/json" \
-H "X-Auth-Token: 35941e7df872405d84e5b026dba8323c" \
-d '{"volumeAttachment": {"volumeId": "9bcd5857-37d1-4c2f-9f16-6d2f6e3cc115","device": "/dev/vdd"}}' \
HTTP/1.1 200 OK
Date: Wed, 10 Dec 2014 10:00:56 GMT
Server: Apache
Content-Length: 194
Content-Type: text/html; charset=UTF-8

    "volumeAttachment": {
        "device": "/dev/vdd",
        "id": "9bcd5857-37d1-4c2f-9f16-6d2f6e3cc115",
        "serverId": "e25b3611-96df-4514-a54b-7729aec48dc1",
        "volumeId": "9bcd5857-37d1-4c2f-9f16-6d2f6e3cc115"