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
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 |
---|---|---|---|
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
Attach a SCSI EVS disk to the 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 }
Example Response
{ "job_id": "ff80808288d41e1b018990260955686a" }
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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot