Update volume

Overview

Updates a volume.

Classification

  • Update

API Operation Object

  • volumes

Synchronous / Asynchronous

  • -

Request

HTTP Request Method

  • PUT

HTTP Request Path

{api_endpoint}/v2/{tenant_id}/volumes/{volume_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

{
    "volume": {
        "name": "<display_name>",
        "description": "<description>"
    }
}

Request Parameter

Request Parameters
name style format description required/optional
tenant_id URI String The unique identifier of the tenant or account. required
volume_id URI UUID The unique identifier of an existing volume. required
name plain String The volume name. required
description plain String The volume description. 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 "X-Openstack-Request-Id", "Content-Length", "Date"

Response Code

Response Codes
response code condition
200 normal end
* Follow a Common Error Code

HTTP Response Body

Format

{
    "volume": {
        "status": "<status>",
        "attachments": [],
        "links": [
            {
                "href": "<volume_URL>",
                "rel": "self"
            },
            {
                "href": "<bookmark_URL>",
                "rel": "bookmark"
            }
        ],
        "availability_zone": "<availability_zone>",
        "source_volid": <source_volid>,
        "snapshot_id": <snapshot_id>,
        "id": "<volume_id>",
        "description": "<description>",
        "name": "<display_name>",
        "created_at": "<created_at>",
        "volume_type": "<volume_type_name>",
        "size": <volume_size>,
        "metadata": {
            "contents": "not junk"
        }
    }
}

Response Parameter

Response Parameters
item format description
status String The volume status.
name String The volume name.
attachments dict One or more instance attachments.
availability_zone String The availability zone.
created_at time/date Date and time when the volume was created.
description String The volume description.
volume_type String The associated volume type.
snapshot_id UUID The ID of the source volume snapshot.
source_volid UUID The ID of the source volume.
metadata String One or more metadata key and value pairs to associate with the volume.
id UUID The volume ID.
size int The size of the volume, in gibibytes (GiB).

Sample API Request and Response

Sample API Request

Request URI

https://example.com/v2/{tenant_id}/volumes/{volume_id}

Request Header

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

Request Body

{
    "volume": {
        "name": "vol-003",
        "description": "This is yet, another volume."
    }
}

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 "X-Openstack-Request-Id", "Content-Length", "Date"

Response Body

{
    "volume": {
        "status": "available",
        "attachments": [],
        "links": [
            {
                "href": "http://localhost:8776/v2/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/5aa119a8-d25b-45a7-8d1b-88e127885635",
                "rel": "self"
            },
            {
                "href": "http://localhost:8776/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/5aa119a8-d25b-45a7-8d1b-88e127885635",
                "rel": "bookmark"
            }
        ],
        "availability_zone": "nova",
        "source_volid": null,
        "snapshot_id": null,
        "id": "5aa119a8-d25b-45a7-8d1b-88e127885635",
        "description": "This is yet, another volume.",
        "name": "vol-003",
        "created_at": "2013-02-25T02:40:21.000000",
        "volume_type": "None",
        "size": 1,
        "metadata": {
            "contents": "not junk"
        }
    }
}

Execution Example

HTTP Request

PUT /v2/cb8aa2a2c7244af5aab1fa7881ba7f4c/volumes/ec48eb1f-f32e-43ee-97ab-9a6c453bc3b2 HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8776
X-Auth-Token: e5b9c5a08fa3481f848792a79378251e
Content-type: application/json
Accept: application/json
Content-Length: 77

{"volume": {"name": "vol-003","description": "This is yet, another volume."}}

HTTP Response

HTTP/1.1 200 OK
X-Compute-Request-Id: req-c168583e-53b5-49da-ba79-b03c7dda5667
Content-Type: application/json
Content-Length: 774
X-Openstack-Request-Id: req-c168583e-53b5-49da-ba79-b03c7dda5667
Date: Thu, 15 Oct 2015 09:33:12 GMT

{"volume": {"status": "available", "user_id": "857ce5a8b28b4233b019d047fec80276", "attachments": [], "links": [{"href": "http://192.168.56.250:8776/v2/cb8aa2a2c7244af5aab1fa7881ba7f4c/volumes/ec48eb1f-f32e-43ee-97ab-9a6c453bc3b2", "rel": "self"}, {"href": "http://192.168.56.250:8776/cb8aa2a2c7244af5aab1fa7881ba7f4c/volumes/ec48eb1f-f32e-43ee-97ab-9a6c453bc3b2", "rel": "bookmark"}], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-10-15T09:29:28.000000", "description": "This is yet, another volume.", "volume_type": "lvmdriver-1", "name": "vol-003", "replication_status": "disabled", "consistencygroup_id": null, "source_volid": null, "snapshot_id": null, "metadata": {}, "id": "ec48eb1f-f32e-43ee-97ab-9a6c453bc3b2", "size": 1}}

Error Execution Example

HTTP Request

PUT /v2/cb8aa2a2c7244af5aab1fa7881ba7f4/volumes/ec48eb1f-f32e-43ee-97ab-9a6c453bc3b2 HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8776
X-Auth-Token: e5b9c5a08fa3481f848792a79378251e
Content-type: application/json
Accept: application/json
Content-Length: 77

{"volume": {"name": "vol-003","description": "This is yet, another volume."}}

HTTP Response

HTTP/1.1 400 Bad Request
Content-Length: 65
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-49dc502c-d213-4e7f-b858-fab30015e81f
X-Openstack-Request-Id: req-49dc502c-d213-4e7f-b858-fab30015e81f
Date: Thu, 15 Oct 2015 09:33:27 GMT

{"badRequest": {"message": "Malformed request url", "code": 400}}