挂载磁盘
描述
实例的状态必须为 running 或者 stopped,且实例的 OperationLocks 中没有标记 "LockReason" : "security" 的锁定状态,且不欠费。
在该接口中设置的 DeleteWithInstance 属性,在实例的 OperationLocks 中标记为"LockReason" : "security" 的锁定状态时,释放实例时会忽略磁盘的 DeleteWithInstance 属性而被同时释放。
请求参数
| 名称 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| Action | String | 是 | 操作接口名,系统规定参数,取值:AttachDisk |
| InstanceId | String | 是 | 目标云服务器 ID |
| DiskId | String | 是 | 磁盘 ID,磁盘和 Instance 必须在同一个 Zone |
| Device | String | 否 | 空表示由系统默认分配,/dev/xvdb 开始到 /dev/xvdz 默认值:空 |
| DeleteWithInstance | String | 否 | 磁盘是否随实例释放:
|
返回参数
全是公共返回参数,详见公共返回参数
错误码
| 错误代码 | 描述 | Http 状态码 | 语义 |
|---|---|---|---|
| MissingParameter | The input parameter "InstanceId" that is mandatory for processing this request is not supplied. | 400 | InstanceId 未指定 |
| MissingParameter | The input parameter "DiskId" that is mandatory for processing this request is not supplied. | 400 | DiskId 未指定 |
| InvalidInstanceId.NotFound | The specified instance does not exist. | 404 | 指定的实例不存在 |
| InvalidDiskId.NotFound | The specified disk does not exist. | 404 | 指定的磁盘不存在 |
| InvalidDevice.Malformed | The specified device is not valid. | 400 | 指定的磁盘不存在 |
| InvalidParameter | The specified parameter "DeleteWithInstance" is not valid. | 400 | 指定的 DeleteWithInstance 参数不合法 |
| InstanceDiskLimitExceeded | The amount of the disk on instance in question reach its limits. | 403 | 指定实例已经达到可挂载磁盘的最大值 |
| InvalidDevice.InUse | The specified device has been occupied. | 403 | 指定的设备已经挂载了磁盘 |
| IncorrectDiskStatus | The operation is not supported in this status. | 403 | 磁盘状态不正确 |
| DiskNotPortable | It is not a portable disk. | 403 | 指定磁盘不是可卸载的磁盘 |
| InstanceLockedForSecurity | The instance is locked due to security. | 403 | 指定的实例被安全锁定 |
| ResourcesNotInSameZone | The specified instance and disk are not in the same zone. | 403 | 指定磁盘和实例不在同一个可用区 |
| InstanceExpiredOrInArrears | The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). | 403 | 指定的实例已欠费 |
| DiskInArrears | The specified operation is denied as your disk owing fee. | 403 | 指定的磁盘已欠费 |
| IncorrectInstanceStatus | The current status of the resource does not support this operation. | 400 | 指定的实例状态不正确 |
| DiskError | IncorrectDiskStatus | 403 | 不正常的磁盘状态 |
示例
请求示例
https://ecs.aliyuncs.com/?action=AttachDisk
&InstanceId=i-23jggx34b
&DiskId=d-23jbf2v5m
&<公共请求参数>
返回示例
XML格式:
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
JSON格式:
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}