Attaching a Disk to an ECS¶
Function¶
This API is used to attach a disk to an ECS.
This API is an asynchronous API. After the attachment request is successfully delivered, a job ID is returned. This does not mean the attachment is complete. You need to call the API by referring to Querying Task Execution Status to query the job status. The SUCCESS status indicates that the attachment is successful.
URI¶
POST /v1/{project_id}/cloudservers/{server_id}/attachvolume
Table 1 describes the parameters in the URI.
Parameter | Mandatory | Description |
|---|---|---|
project_id | Yes | Specifies the project ID. |
server_id | Yes | Specifies the ECS ID. |
Request¶
Parameter | Mandatory | Type | Description |
|---|---|---|---|
volumeAttachment | Yes | Object | Specifies the ECS attachment information. For details, see Table 3. |
dry_run | No | Boolean | Specifies whether to check the request and attach the disk.
The default value is false. |
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
|
volume_type | No | String | Specifies the disk type. |
count | No | Integer | Specifies the number of disks. |
hw:passthrough | No | String |
|
Response¶
See Responses (Task).
Example Request¶
Attach a SCSI EVS disk to device /dev/sda.
POST https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/attachvolume { "volumeAttachment": { "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", "device": "/dev/sda", "volume_type": "SSD", "count": 5, "hw:passthrough": "true" }, "dry_run": false }Send a pre-check request for attaching a disk.
POST https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/attachvolume { "volumeAttachment": { "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", "volume_type": "SSD", "count": 1, "hw:passthrough": "true" }, "dry_run": true }
Example Response¶
{
"job_id": "ff80808288d41e1b018990260955686a"
}
Returned Values¶
Error Codes¶
See Error Codes.