• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. Status Management
  6. Rebuilding an ECS

Rebuilding an ECS

Function

This API is used to rebuild an ECS.

You can use the original image or another image to rebuild an ECS. This API supports different OSs.

Notes

This API is native from the community for defcore tests.

If you are required to reinstall or change an ECS OS, ECS APIs are recommended. For details, see "Reinstalling an ECS OS (Using an Image with Cloud-Init Installed)" and "Changing an ECS OS (Using an Image with Cloud-Init Installed)".

URI

POST /v2.1/{project_id}/servers/{server_id}/action

URI parameters

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

server_id

Yes

Specifies the ECS ID.

Constraints

  • ECSs in the error state cannot be rebuilt.
  • The password cannot be set during the rebuilding.
  • ECSs in yearly/monthly payments do not support rebuilding.

Request

Request parameters

Table 2 describes the request parameters.

Table 2 Request parameter

Parameter

Type

Mandatory

Description

rebuild

Dict

Yes

Rebuilds an ECS.

Table 3 rebuild parameter information

Parameter

Type

Mandatory

Description

name

String

No

Specifies the name of the rebuilt ECS.

The value contains 1 to 254 characters.

metadata

Dict

No

Specifies the metadata of the rebuilt ECS.

imageRef

String

Yes

Specifies the image ID or URL.

adminPass

String

No

Specifies the password for logging in to the rebuilt ECS. This parameter does not take effect.

OS-DCF:diskConfig

String

No

Not supported

preserve_ephemeral

Boolean

No

Specifies whether to retain the temporary disk. This parameter is not supported.

key_name

String

No

Specifies the key pair name. If the value is null, the existing key pair is left blank.

This field is supported in microversion 2.54.

user_data

String

No

Specifies the user data. This parameter is an extended attribute. The character string contains 1 to 65,534 characters and must be encrypted using Base64.

This field is supported in microversion 2.57.

Response

Response parameters

Table 4 describes the response parameters.

Table 4 Response parameters

Parameter

Type

Description

status

String

Specifies the ECS status.

Values:

  • ACTIVE
  • REBOOT
  • HARD_REBOOT
  • REBUILD
  • MIGRATING
  • BUILD
  • SHUTOFF
  • RESIZE
  • VERIFY_RESIZE
  • ERROR
  • DELETED

updated

String

Specifies the time when the ECS was updated last time.

hostId

String

Specifies the ID of the host on which the ECS is deployed.

addresses

List(Dict)

Specifies the network attribute of the ECS.

links

List(Dict)

Specifies the description of the ECS.

image

Dict

Specifies the ECS image information. For the ECS that boots from a volume, the value is left blank.

flavor

Dict

Specifies the ECS flavor.

id

String

Specifies the ECS ID in UUID format.

user_id

String

Specifies the user UUID of the ECS.

name

String

Specifies the ECS name.

tenant_id

String

Specifies the UUID of the tenant who owns the ECS.

OS-DCF:diskConfig

String

Specifies the diskConfig type. It is an extended attributed.

  • MANUAL: The image space cannot be expanded.
  • AUTO: The image space on the system disk will be automatically expanded to keep the same as that set in the flavor.

accessIPv4

String

Discarded

accessIPv6

String

Discarded

progress

String

Specifies the ECS creation progress.

metadata

Dict

Specifies the ECS metadata.

Examples

  • Example request
    {
        "rebuild" : {
            "imageRef" : "3ed456f5-3d8f-4383-a6c9-312032afcd1a",
            "name" : "rebuildName",
           "metadata" : {
                "rebuild" : "rebuild vm"
            }
        }
    }
  • Example response
    {
        "server": {
            "tenant_id": "7459f9935ed2422eb9800fea1d4d9378",
            "image": {
                "links": [
                    {
                        "rel": "bookmark",
                        "href": "https://172.30.32.132:443/7459f9935ed2422eb9800fea1d4d9378/images/3ed456f5-3d8f-4383-a6c9-312032afcd1a"
                    }
                ],
                "id": "3ed456f5-3d8f-4383-a6c9-312032afcd1a"
            },
            "accessIPv4": "",
            "addresses": {
                "443dd9e3-c165-4764-ad92-b17fcf12a3eb": [
                    {
                        "addr": "192.168.0.119",
                        "version": 4
                    }
                ]
            },
            "metadata": {
                "name": "rebuildName"
            },
            "accessIPv6": "",
            "created": "2016-09-19T01:13:26Z",
            "hostId": "fd16ebd9c2629e8595875cc1e1400fa67f392431d7937fcc9cf37671",
            "adminPass": "qGVjnEjY3ZoY",
            "flavor": {
                "links": [
                    {
                        "rel": "bookmark",
                        "href": "https://172.30.32.132:443/7459f9935ed2422eb9800fea1d4d9378/flavors/normal1"
                    }
                ],
                "id": "normal1"
            },
            "OS-DCF:diskConfig": "MANUAL",
            "user_id": "ed2965d80d394be0b41e56f50ac650ca",
            "name": "rebuildName",
            "progress": 0,
            "links": [
                {
                    "rel": "self",
                    "href": "https://172.30.32.132:443/v2/7459f9935ed2422eb9800fea1d4d9378/servers/ea681a24-9b24-4f49-98ef-8e1f73acf19e"
                },
                {
                    "rel": "bookmark",
                    "href": "https://172.30.32.132:443/7459f9935ed2422eb9800fea1d4d9378/servers/ea681a24-9b24-4f49-98ef-8e1f73acf19e"
                }
            ],
            "id": "ea681a24-9b24-4f49-98ef-8e1f73acf19e",
            "updated": "2016-09-19T07:22:05Z",
            "status": "REBUILD"
        }
    }

Returned Values

See General Request Returned Values.