List volume attachments

Overview

Lists the volume attachments for a specified server.

Classification

  • List

API Operation Object

  • os-volume_attachments

Synchronous / Asynchronous

  • -

Request

HTTP Request Method

  • GET

HTTP Request Path

{api_endpoint}/v2/{tenant_id}/servers/{server_id}/os-volume_attachments

HTTP Request Header

Format

Accept-Encoding: gzip, deflate, compress (optional)
Accept: application/json
X-Auth-Token: <token_id>
Content-Type: application/json

HTTP Request Body

Format

  • none

Request Parameter

Request Parameters
name style format description required/optional
tenant_id URI String The ID for the tenant or account in a multi-tenancy cloud. required
server_id URI UUID The UUID for the server of interest to you. required

Response

HTTP Response Header

Format

HTTP/1.1 <response_code> <message>       (ex. 200 OK)
  • <response_code>: see "HTTP Responses" section

  • <message>: message based on the response code

    • skip auto insert field such as "X-Compute-Request-Id" and "Content-Length", "Date"

Response Code

Response Codes
response code condition
200 normal end
400 badRequest
- NetworkNotFound
401 unauthorized
403 forbidden
404 itemNotFound
405 badMethod
409 buildInProgress
413 overLimit
415 badMediaType
503 serviceUnavailable

HTTP Response Body

Format

{
    "volumeAttachments": [
        {
            "device": "<device>",
            "id": "<id>",
            "serverId": "<instance_id>",
            "volumeId": "<volumeId>"
        },
        {
            <<repeat>>
        }
    ]
}

Response Parameter

Response Parameters
item format description
device String(^/dev/x{0,1}[a-z]{0,1}d{0,1})([a-z]+)[0-9]*$ device name
id UUID String attachment id
serverId UUID String instance id
volumeId UUID String volume id

Sample API Request and Response

Sample API Request

Request URI

https://example.com/v2/{tenant_id}/servers/{server_id}/os-volume_attachments

Request Header

Accept-Encoding: gzip, deflate, compress (optional)
Accept: application/json
X-Auth-Token: ajk3adjiown02
Content-Type: application/json

Request Body

  • none

Sample API Response

Response Header

HTTP/1.1 200 OK
  • <response_code>: see "HTTP Responses" section

  • <message>: message based on the response code

    • skip auto insert field such as "X-Compute-Request-Id" and "Content-Length", "Date"

Response Body

{
    "volumeAttachments": [
        {
            "device": "/dev/sdd",
            "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
            "serverId": "4d8c3732-a248-40ed-bebc-539a6ffd25c0",
            "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803"
        },
        {
            "device": "/dev/sdc",
            "id": "a26887c6-c47b-4654-abb5-dfadf7d3f804",
            "serverId": "4d8c3732-a248-40ed-bebc-539a6ffd25c0",
            "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804"
        }
    ]
}

Execution Example

HTTP Request

GET /v2/cb8aa2a2c7244af5aab1fa7881ba7f4c/servers/2a5c8d7e-7041-468b-8a2c-06b4c802205c/os-volume_attachments HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token: f895e1ba4ce2495cb2fd636e871842ca
Content-type: application/json
Accept: application/json

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 25
X-Compute-Request-Id: req-84704a28-164a-460a-abe8-59b413827e84
Date: Thu, 15 Oct 2015 06:42:31 GMT

{"volumeAttachments": [{"device": "/dev/vda", "serverId": "2a5c8d7e-7041-468b-8a2c-06b4c802205c", "id": "c635fea8-6983-4c84-a175-19193c3408c8", "volumeId": "c635fea8-6983-4c84-a175-19193c3408c8"}, {"device": "/dev/vdb", "serverId": "2a5c8d7e-7041-468b-8a2c-06b4c802205c", "id": "c85e8df1-28ce-418e-a242-a210dc915bf3", "volumeId": "c85e8df1-28ce-418e-a242-a210dc915bf3"}]}

Error Execution Example

HTTP Request

GET /v2/cb8aa2a2c7244af5aab1fa7881ba7f4/servers/df82dc3f-98e0-4f68-8b75-db8aee7905ab/os-volume_attachments HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token: f895e1ba4ce2495cb2fd636e871842ca
Content-type: application/json
Accept: application/json

HTTP Response

HTTP/1.1 400 Bad Request
Content-Length: 187
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-e21b8c84-1b7d-42f7-9658-1570f2e9af35
Date: Thu, 15 Oct 2015 06:42:11 GMT

{"badRequest": {"message": "Malformed request URL: URL's project_id 'cb8aa2a2c7244af5aab1fa7881ba7f4' doesn't match Context's project_id 'cb8aa2a2c7244af5aab1fa7881ba7f4c'", "code": 400}}