Detach volume

Overview

Deletes the specified volume attachment.

Classification

  • Detach

API Operation Object

  • os-volume_attachments

Synchronous / Asynchronous

  • asynchronous

Request

HTTP Request Method

  • DELETE

HTTP Request Path

{api_endpoint}/v2/{project_id}/servers/{server_id}/os-volume_attachments/{attachment_id}

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 default value action for invalid parameter response code for invalid parameter
project_id URL UUID(3) Project id required - Terminate 400, 404
server_id URL UUID String instance id required - Terminate 404
attachment_id URL UUID String attachment id required - Terminate 404
token_id Header authentication token string keystone authentication token required - Terminate 401

Response

HTTP Response Header

Format

HTTP/1.1 <response_code> <message>       (ex. 202 Accepted)
  • <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
202 normal end
400 not found volumeAttachment entity in body
- not found voumeId attribute in body
- invalid the project_id
- the volume is already detached(volume status == available)
401 unauthorized
403 can't detach root device volume
404 not found a specified instance
- not found a specified project
- not found a specified attachment
409 vm_state isn't ACTIVE, PAUSED, STOPPED, RESIZED, SOFT_DELETED

HTTP Response Body

Format

  • none

Response Parameter

Response Parameters
item format description
none - -

Sample API Request and Response

Sample API Request

Request URI

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

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 202 Accepted
  • <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

  • none

Execution Example

HTTP Request

DELETE /v2/b7a7b63e92174a95a999c95da856f143/servers/da5834e0-31d2-40f9-b271-6592f9f68370/os-volume_attachments/eef897c2-e61b-4a18-84e9-ac44ebb34c7b HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.150.51:8774
Accept-Encoding: gzip, deflate, compress
Accept: application/json
X-Auth-Token: b3a07ef1f2954424a9c56876d88f6751

HTTP Response

HTTP/1.1 202 Accepted
Content-Type: text/html; charset=UTF-8
Content-Length: 0
X-Compute-Request-Id: req-b792dc55-df3f-487f-8c9c-1beede1cfae7
Date: Tue, 19 Aug 2014 11:34:21 GMT

Error Execution Example

HTTP Request

DELETE /v2/b7a7b63e92174a95a999c95da856f143/servers/da5834e0-31d2-40f9-b271-6592f9f68370/os-volume_attachments/eef897c2-e61b-4a18-84e9-ac44ebb34c7b HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token: d9bd7697eb5b4d2c9594b2156475faf0
Content-type: application/json
Accept: application/json

HTTP Response

HTTP/1.1 400 Bad Request
Content-Length: 188
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-9f5563ca-93db-4499-8037-dae82ee49e3e
Date: Tue, 13 Oct 2015 06:07:29 GMT

{"badRequest": {"message": "Malformed request URL: URL's project_id 'b7a7b63e92174a95a999c95da856f143' doesn't match Context's project_id '9e691df1813f4737a5c505b4cab89a96'", "code": 400}}