Modifying an ECS
Function
This API is used to modify ECS information. Only the name, description, and hostname of an ECS can be modified currently.
Constraints
After the hostname of an ECS is changed, you need to restart the ECS for the configuration to take effect.
URI
PUT /v1/{project_id}/cloudservers/{server_id}
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
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
server |
Yes |
Object |
Specifies the ECS data structure. For details, see Table 3. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Specifies the name of the modified ECS. The parameter value consists of 1 to 64 characters, including letters, digits, underscores (_), and hyphens (-). |
description |
No |
String |
Describes the ECS. The value consists of 0-85 characters and cannot contain brackets (<>). |
hostname |
No |
String |
Specifies the ECS hostname. The name consists of 1-64 characters. It can be segmented using periods (.). Only letters, digits, and hyphens (-) are allowed in each segment. A name cannot contain consecutive periods (.) or hyphens (-), and cannot start or end with a period (.) or hyphen (-). Additionally, the combinations of (.-) and (-.) are not allowed. |
Response
Table 4 describes the response parameters.
Parameter |
Type |
Description |
---|---|---|
server |
Object |
Specifies the ECS. For details, see Table 5. |
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 attributed network information of the ECS. The structure is Map<String, Object>. 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 the ECS flavor. For details, see Table 7. |
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 ECS. For details, see Table 8. |
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 parameter is supported in microversion 2.9 and later. |
description |
String |
Describes the ECS. This parameter is supported in microversion 2.19 and later. |
tags |
Array of strings |
Specifies ECS tags. This parameter is supported in microversion 2.26 and later. If the microversion is not used for query, the response does not contain the tags field.
Tag functions have been upgraded on the cloud service platform. After the upgrade, the tag values returned by the system comply with the following rules:
|
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. |
OS-EXT-SRV-ATTR:hostname |
String |
Specifies the ECS hostname. |
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.
|
Parameter |
Type |
Description |
---|---|---|
id |
String |
Specifies the ECS ID. |
links |
Array of objects |
Specifies shortcut links for ECS types. For details, see Table 8. |
Example Request
PUT https://{endpoint}/v1/{project_id}/cloudservers/{server_id}
{ "server": { "name": "new-server-test" } }
Example Response
{ "server": { "tenant_id": "66c860cb130b465fbafcdee43fb09c64", "image": "", "accessIPv4": "", "addresses": { "01d7aef8-442b-408e-b82f-13afff51e4e4": [ { "addr": "192.168.26.22", "version": 4 } ] }, "metadata": { "virtual_env_type": "FusionCompute" }, "description": "", "accessIPv6": "", "created": "2019-04-25T11:52:53Z", "hostId": "57d278e7c53d07cd34fad3ba4fdc9f3d779017d0879726d83b45a22a", "OS-EXT-SRV-ATTR:hostname": "new-test-hostname", "flavor": { "links": [ { "rel": "bookmark", "href": "https://None/66c860cb130b465fbafcdee43fb09c64/flavors/s2.large.2" } ], "id": "s2.large.2" }, "OS-DCF:diskConfig": "MANUAL", "user_id": "f88581d53be64716a985c66ca28c75f6", "name": "new-test-hostname", "progress": 0, "links": [ { "rel": "self", "href": "https://None/v2/66c860cb130b465fbafcdee43fb09c64/servers/24930df0-db4c-4a8b-8914-d0bd558564b0" }, { "rel": "bookmark", "href": "https://None/66c860cb130b465fbafcdee43fb09c64/servers/24930df0-db4c-4a8b-8914-d0bd558564b0" } ], "id": "24930df0-db4c-4a8b-8914-d0bd558564b0", "updated": "2019-04-28T08:15:36Z", "status": "ACTIVE" } }
Returned Values
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.