Modifying ECS Information

Function

This API is used to modify ECS information. Only the name and description of an ECS can be modified.

URI

PUT /v2.1/{project_id}/servers/{server_id}

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

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

server_id

Yes

Specifies the ECS ID.

Request

Table 2 describes the request parameters.
Table 2 Request parameters

Parameter

Mandatory

Type

Description

server

Yes

Object

Specifies the ECS data structure. For details, see Table 3.

Table 3 server field description

Parameter

Mandatory

Type

Description

name

No

String

Specifies the name of the modified ECS.

The length is greater than 0 and less than 256

description

No

String

Describes the ECS. The value contains a maximum of 255 bytes.

This field is supported in microversions 2.19 and later.

Response

Table 4 describes the response parameters.

Table 4 Response parameters

Parameter

Type

Description

server

Object

Specifies ECS information. For details, see Table 5.

Table 5 server field description

Parameter

Type

Description

tenant_id

String

Specifies the tenant or project ID.

image

String

Specifies the image ID.

accessIPv4

String

Reserved

addresses

Object

Specifies the network addresses of an ECS. For details, see Table 6.

metadata

Object

Specifies the ECS metadata.

accessIPv6

String

Reserved

created

String

Specifies the time when the ECS was created. The time is in the format of "2019-05-22T03:19:19Z".

hostId

String

Specifies the host ID of the ECS.

flavor

Object

Specifies ECS flavor. For details, see Table 8.

OS-DCF:diskConfig

String

Specifies the disk configuration mode. This is an extended attribute. This field is valid for the ECS started using an image.

user_id

String

Specifies the ID of the user to which an ECS belongs.

name

String

Specifies the name of the modified ECS.

progress

Integer

Reserved

links

Array of Object

Specifies ECS shortcut links. For details, see Table 9.

id

String

Specifies the unique ID of an ECS.

updated

String

Specifies the time when the ECS was updated last time.

The time is in the format of "2019-05-22T03:19:19Z".

locked

Boolean

Specifies the ECS lock status, which is True when the ECS is locked and False when the ECS is unlocked.

This field is supported in microversions later than 2.9.

description

String

Describes the ECS.

This field is supported in microversions later than 2.19.

tags

Array of strings

Specifies ECS tags.

This field is supported in microversions later than 2.26. If the microversion is not used for query, the response does not contain the tags field.

Tag functions have been upgraded on the public cloud. After the upgrade, the tag values returned by the system comply with the following rules:
  • The key and value of a tag are connected using an equal sign (=), for example, key=value.
  • If the value is empty, only the key is returned.
  • The key and value of a tag are connected using an equal sign (=), for example, key=value.
  • If the value is empty, only the key is returned.

status

String

Specifies the ECS status.

Options:

ACTIVE, BUILD, ERROR, HARD_REBOOT, MIGRATING, REBOOT, RESIZE, REVERT_RESIZE, SHELVED, SHELVED_OFFLOADED, SHUTOFF, UNKNOWN, and VERIFY_RESIZE

For details, see ECS Statuses.

Table 6 addresses field description

Parameter

Type

Description

Name the network where the ECS accesses

Object

Specifies the network information of the ECS.

  • key indicates the network name, for example, demo_net.
  • value indicates the detailed network information.

For details, see Table 7.

Table 7 Data structure of the network which an ECS accesses

Parameter

Type

Description

addr

String

Specifies the IP address.

version

Integer

Specifies the type of an IP address. The value of this parameter can be 4 or 6.

  • 4: The type of the IP address is IPv4.
  • 6: The type of the IP address is IPv6.
Table 8 flavor field description

Parameter

Type

Description

id

String

Specifies the ECS ID.

This field is not supported in microversions later than 2.47.

links

Array of objects

Specifies shortcut links for ECS types. For details, see Table 9.

This field is not supported in microversions later than 2.47.

vcpus

Integer

Specifies the number of vCPUs in the ECS flavor.

This field is supported in microversions later than 2.47.

ram

Integer

Specifies the memory size (MB) in the ECS flavor.

This field is supported in microversions later than 2.47.

disk

Integer

Specifies the system disk size in the ECS flavor. Value 0 indicates that the disk size is not limited.

This field is supported in microversions later than 2.47.

ephemeral

Integer

Reserved

This field is supported in microversions later than 2.47.

swap

Integer

Reserved

This field is supported in microversions later than 2.47.

original_name

String

Specifies the name of the ECS flavor.

This field is supported in microversions later than 2.47.

extra_specs

Object

Indicates an extended flavor field. For details, see os_extra_specs (flavor) Field Description.

This field is supported in microversions later than 2.47.

Table 9 links field description

Parameter

Type

Description

rel

String

Specifies the shortcut link marker name.

href

String

Specifies the shortcut link.

Example Request

PUT https://{endpoint}/v2.1/{project_id}/servers/{server_id}
{
    "server": {
        "name": "new-server-test"
    }
}

Example Response

{
  "server": {
    "tenant_id": "7910a6e50b80402ba028c8d96c1b31fe",
    "image": "",
    "accessIPv4": "",
    "addresses": {
      "03be5c1e-e05d-4905-a105-c3bd9b730bdc": [
        {
          "addr": "192.168.0.72",
          "version": 4
        }
      ]
    },
    "metadata": {},
    "accessIPv6": "",
    "created": "2018-05-17T03:15:48Z",
    "hostId": "7dc82f6b1d406200fc63e395cf4829cbffcb49de0e9c75c5773f201f",
    "flavor": {
      "links": [
        {
          "rel": "bookmark",
          "href": "https://None/7910a6e50b80402ba028c8d96c1b31fe/flavors/c3.1U1G"
        }
      ],
      "id": "c3.1U1G"
    },
    "OS-DCF:diskConfig": "MANUAL",
    "user_id": "d698a78532ca430f8daec1858f2b500e",
    "name": "new-server-test",
    "progress": 0,
    "links": [
      {
        "rel": "self",
        "href": "https://None/v2/7910a6e50b80402ba028c8d96c1b31fe/servers/1a19ef4f-be0a-4526-bf2f-14b4464d536a"
      },
      {
        "rel": "bookmark",
        "href": "https://None/7910a6e50b80402ba028c8d96c1b31fe/servers/1a19ef4f-be0a-4526-bf2f-14b4464d536a"
      }
    ],
    "id": "1a19ef4f-be0a-4526-bf2f-14b4464d536a",
    "updated": "2018-05-21T00:36:27Z",
    "status": "ACTIVE"
  }
}