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.
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. If volumeId is unavailable and dry_run is set to true, volume_type is available and must be specified. |
count | No | Integer | Specifies the number of disks. If volumeId is unavailable and dry_run is set to true, count is available. If count is unavailable, the number of disks is 1 by default. |
hw:passthrough | No | String |
If volumeId is unavailable and dry_run is set to true, hw:passthrough is available and must be specified. |
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",
"volume_type": "SSD",
"count": 5,
"hw:passthrough": "true"
},
"dry_run": false
}
Example Response¶
{
"job_id": "70a599e0-31e7-49b7-b260-868f441e862b"
}
Returned Values¶
Error Codes¶
See Error Codes.