Resize server

Overview

Resizes the specified server.

Classification

  • Resize

API Operation Object

  • action

Synchronous / Asynchronous

  • asynchronous

Request

HTTP Request Method

  • POST

HTTP Request Path

{api_endpoint}/v2/{project_id}/servers/{server_id}/action

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

{
    "resize": {
        "flavorRef": "<flavor_id>",
        "OS-DCF:diskConfig": "AUTO"
    }
}

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

token_id

Header

authentication token string

keystone authentication token

required

-

Terminate

401

flavor_id

Body

String(1-255 characters)

flavor id

required

-

Terminate

400

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

invalid flavorRef value of body *not String(1-255 characters)

-

invalid project_id

-

not found flavorRef attribute of body

-

not found a specified flavor_id

-

specify same flavor(cell_type != compute)

-

no valid host was found

401

unauthorized by keystone

404

not found a specified instance

-

not found a specified project

-

not found a quota(internal error)

409

vm_state isn't ACTIVE,STOPPED

413

over quota(TooManyInstances)

-

over quota(ram)

500

resize to zero disk flavor is not allowed(from non zero disk to zero disk)

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}/action

Request Header

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

Request Body

{
    "resize": {
        "flavorRef": "<flavor_id>",
        "OS-DCF:diskConfig": "AUTO"
    }
}

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

POST /v2/fc07e80bd83849cd9133858713d8ff0e/servers/0d897a21-f275-4d95-9d49-de3c42312262/action 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: 0c3f84f1c25447908ca30534c76e25c9
Content-Type: application/json
Content-Length: 33

{"resize": {"flavorRef": "2","OS-DCF:diskConfig": "AUTO"}}

HTTP Response

HTTP/1.1 202 Accepted
Content-Type: text/html; charset=UTF-8
Content-Length: 0
X-Compute-Request-Id: req-59febb30-05fe-49bd-b691-47f1ac85deb4
Date: Wed, 06 Aug 2014 11:54:45 GMT

Error Execution Example

HTTP Request

POST /v2/895f0b8574504834bd6249d91dbd5a9c/servers/fd2caaa0-cdcb-4f43-bd65-2bdbe29e06b1/action HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token:cd08bf66ed2044c0ae07458cfeb42e82
Accept: application/json
Content-Length: 28
Content-Type: application/x-www-form-urlencoded

HTTP Response

HTTP/1.1 400 Bad Request
Content-Length: 73
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-475de6a2-0269-41a2-865c-9315f35687aa
Date: Thu, 08 Oct 2015 09:35:28 GMT

{"badRequest": {"message": "There is no such action: None", "code": 400}}