閱讀442 返回首頁    go 魔獸


掛載磁盤__磁盤相關接口_API 參考_雲服務器 ECS-阿裏雲

描述

實例的狀態必須為 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 磁盤是否隨實例釋放:
  • true 表示 Instance 釋放時,這塊磁盤隨 Instance 一起釋放;
  • false 表示 Instance 釋放時,這塊磁盤保留不釋放。
默認值:無,表示保留當前值不做修改。

返回參數

全是公共返回參數,詳見公共返回參數

錯誤碼

錯誤代碼 描述 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格式:

<AttachDiskResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</AttachDiskResponse>

JSON格式:

{
    "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

最後更新:2016-11-23 16:03:50

  上一篇:go 查詢磁盤__磁盤相關接口_API 參考_雲服務器 ECS-阿裏雲
  下一篇:go 卸載磁盤__磁盤相關接口_API 參考_雲服務器 ECS-阿裏雲