doc-exports/docs/ecs/api-ref/en-us_topic_0022472987.html
Artem Goncharov 3196b64bfc
move doc sources to other location (#3)
move doc sources to other location

Reviewed-by: OpenTelekomCloud Bot <None>
2022-04-27 16:24:25 +00:00

10 KiB

Attaching a Disk to an ECS

Function

This API is used to attach a disk to an ECS.

URI

POST /v1/{project_id}/cloudservers/{server_id}/attachvolume

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.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

volumeAttachment

Yes

Object

Specifies the ECS attachment information. For details, see Table 3.

Table 3 volumeAttachment field description

Parameter

Mandatory

Type

Description

volumeId

Yes

String

Specifies the ID of the disk to be attached. The value is in UUID format.

device

No

String

Indicates the disk device name.

NOTE:
  • The new disk device name cannot be the same as an existing one.
  • For KVM ECSs, set the parameter value to /dev/vda for system disks. The device names for data disks of KVM ECSs are optional. If the device names of data disks are required, set them in alphabetical order. For example, if there are two data disks, set the device names of the two data disks to /dev/vdb and /dev/vdc, respectively. If you set a device name starting with /dev/sd, the system uses /dev/vd by default.

Response

See Responses (Task).

Example Request

POST https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/attachvolume
{
    "volumeAttachment": {
         "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
         "device": "/dev/sda"
    }
}

Example Response

{
    "job_id": "70a599e0-31e7-49b7-b260-868f441e862b"
}

Error Codes

See Error Codes.