# Changing the Name of a BMS (Native OpenStack API)

#### Function

This interface is used to modify BMS information. Currently, only the name of the BMS can be changed.

#### URI

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

Table 1 lists the parameters.

Table 1 Parameter description
Parameter | Mandatory | Description
--- | --- | ---
project_id | Yes | Specifies the project ID. For how to obtain the project ID, see Obtaining Required Information.
server_id | Yes | Specifies the BMS ID. You can obtain the BMS ID from the BMS console or using the Querying BMSs (Native OpenStack API) API.

#### Request

- Request parameters

  Parameter | Mandatory | Type | Description
  --- | --- | --- | ---
  server | Yes | Object | Specifies the BMS data structure. For details, see Table 2.

  Table 2 server field data structure description
  Parameter | Mandatory | Type | Description
  --- | --- | --- | ---
  name | Yes | String | Specifies the new BMS name.

- Example request

      1

      PUT https://{ECS Endpoint}/v2.1/c685484a8cc2416b97260938705deb65/servers/95bf2490-5428-432c-ad9b-5e3406f869dd

      1
      2
      3
      4
      5

      {
          "server": {
              "name": "new-server-test"
          }
      }

#### Response

- Response parameters

  Parameter | Type | Description
  --- | --- | ---
  name | String | Specifies the BMS name.
  id | String | Specifies the unique ID of the BMS.

  status

  String

  Specifies the current status of the BMS.
  - ACTIVE: Running, Stopping, Deleting
  - BUILD: Creating
  - ERROR: Faulty
  - HARD_REBOOT: Forcibly Restarting
  - REBOOT: Restarting
  - DELETED: Deleted

  created | String | Specifies the time when the BMS was created. The timestamp format is YYYY-MM-DDTHH:MM:SSZ (ISO 8601), for example, 2019-05-22T03:30:52Z.
  updated | String | Specifies the time when the BMS was last updated. The timestamp format is YYYY-MM-DDTHH:MM:SSZ (ISO 8601), for example, 2019-05-22T04:30:52Z.
  flavor | Object | Specifies the BMS flavor information. For details, see Table 3.
  image | Object | Specifies the BMS image. For details, see Table 4.
  tenant_id | String | Specifies the ID of the tenant owning the BMS. The ID is in UUID format. This parameter specifies the same meaning as project_id.
  user_id | String | Specifies the ID of the user to which the BMS belongs.
  metadata | Object | Specifies the BMS metadata. For details, see Table 5.
  hostId | String | Specifies the host ID of the BMS.
  addresses | Object | Specifies the BMS network address. For details, see Table 7.
  links | Array of objects | Specifies the shortcut links of the BMS. For details, see Table 6.
  accessIPv4 | String | This is a reserved attribute.
  accessIPv6 | String | This is a reserved attribute.

  OS-DCF:diskConfig

  String

  Specifies the disk configuration method. This is an extended attribute. The value can be:
  - MANUAL: The API uses the partitioning scheme in the image and the file system to create a BMS. If the target flavor has a large disk, the API does not partition the remaining disk space.
  - AUTO: The API uses a single partition with the same size as the disk of the target flavor to create a BMS. The API automatically adjusts the file system to adapt to the entire partition.

  progress | Integer | This is a reserved attribute.

  Table 3 flavor field data structure description
  Parameter | Type | Description
  --- | --- | ---
  id | String | Specifies the flavor ID.
  links | Array of objects | Specifies the shortcut link of the BMS flavor. For details, see Table 6.

  Table 4 image field data structure description
  Parameter | Type | Description
  --- | --- | ---
  id | String | Specifies the ID of the BMS image.
  links | Array of objects | Specifies the shortcut links of the BMS image. For details, see Table 6.

  Table 5 metadata field data structure description
  Parameter | Type | Description
  --- | --- | ---
  User-defined field key and value pair | String | Specifies the key and value pair of the metadata. Each key or value contains a maximum of 255 characters.

  Table 6 links field data structure description
  Parameter | Type | Description
  --- | --- | ---

  rel

  String

  Specifies the shortcut link marker name. The value can be:
  - self: resource link that contains the version number. It is used when immediate tracing is required.
  - bookmark: resource link that can be stored for a long time.

  href | String | Specifies the corresponding shortcut link.

  Table 7 addresses field data structure description
  Parameter | Type | Description
  --- | --- | ---

  vpc_id

  Array of objects

  Specifies the VPC used by the BMS.
  - key: indicates the ID of the VPC used by the BMS.
  - value: indicates the VPC details. For details, see Table 8.

  Table 8 address field data structure description
  Parameter | Type | Description
  --- | --- | ---
  addr | String | Specifies the IP address.
  version | String | Specifies the version of the IP address.

- Example response

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55

      {
          "server": {
              "tenant_id": "c685484a8cc2416b97260938705deb65",
              "image": {
                  "links": [
                      {
                          "rel": "bookmark",
                          "href": "https://openstack.example.com/c685484a8cc2416b97260938705deb65/images/1a6635d8-afea-4f2b-abb6-27a202bad319"
                      }
                  ],
                  "id": "1a6635d8-afea-4f2b-abb6-27a202bad319"
              },
              "accessIPv4": "",
              "addresses": {
                  "08a7715f-7de6-4ff9-a343-95ba4209f24a": [
                      {
                          "addr": "192.168.0.107",
                          "version": 4
                      }
                  ]
              },
              "metadata": {
                  "op_svc_userid": "1311c433dd9b408886f57d695c229cbe"
              },
              "accessIPv6": "",
              "created": "2017-05-24T06:14:05Z",
              "hostId": "e9c3ee0fcc58ab6085cf30df70b5544eab958858fb50d925f023e53e",
              "flavor": {
                  "links": [
                      {
                          "rel": "bookmark",
                          "href": "https://openstack.example.com/c685484a8cc2416b97260938705deb65/flavors/physical.83.medium"
                      }
                  ],
                  "id": "physical.83.medium"
              },
              "OS-DCF:diskConfig": "MANUAL",
              "user_id": "1311c433dd9b408886f57d695c229cbe",
              "name": "new-server-test",
              "progress": 0,
              "links": [
                  {
                      "rel": "self",
                      "href": "https://openstack.example.com/v2/c685484a8cc2416b97260938705deb65/servers/95bf2490-5428-432c-ad9b-5e3406f869dd"
                  },
                  {
                      "rel": "bookmark",
                      "href": "https://openstack.example.com/c685484a8cc2416b97260938705deb65/servers/95bf2490-5428-432c-ad9b-5e3406f869dd"
                  }
              ],
              "id": "95bf2490-5428-432c-ad9b-5e3406f869dd",
              "updated": "2017-05-25T03:40:25Z",
              "status": "ACTIVE"
          }
      }

#### Returned Values

Normal values

Returned Values | Description
--- | ---
200 | The request has been successfully processed.

For details about other returned values, see Status Codes.

#### Error Codes

See Error Codes.

Parent topic: BMS Status Management