調用DetachDisk從一臺ECS實例上卸載一塊按量付費數據盤,或者卸載一塊系統盤。
接口說明
調用該接口時,請注意:
- 磁盤必須已經掛載到實例上,狀態為使用中(
In_use
)。 - 卸載數據盤時,所掛載的實例必須處于運行中(
Running
)或者已停止(Stopped
)狀態。 - 卸載系統盤時,所掛載的實例必須處于已停止(
Stopped
)狀態。 - 所掛載的實例被安全控制后,
OperationLocks
中不能標記為"LockReason" : "security"
的鎖定狀態。 - DetachDisk 是異步操作,調用接口成功后等待一分鐘左右才能完成卸載。
- 彈性臨時盤一旦卸載,只能重新掛載至其原始實例。
調試
您可以在OpenAPI Explorer中直接運行該接口,免去您計算簽名的困擾。運行成功后,OpenAPI Explorer可以自動生成SDK代碼示例。
授權信息
當前API暫無授權信息透出。
請求參數
名稱 | 類型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
InstanceId | string | 是 | 待卸載的 ECS 實例 ID。 | i-bp67acfmxazb4p**** |
DiskId | string | 是 | 待卸載的磁盤 ID。 | d-bp67acfmxazb4p**** |
DeleteWithInstance | boolean | 否 | 卸載系統盤或數據盤時,設置自動釋放屬性。表示釋放 ECS 實例時,是否同時釋放該系統盤或數據盤。
默認值:true 您需要注意:
| false |
返回參數
示例
正常返回示例
JSON
格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
錯誤碼
HTTP status code | 錯誤碼 | 錯誤信息 | 描述 |
---|---|---|---|
400 | InvalidParameter | The input parameter is mandatory for processing this request is empty. | 參數不能為空。 |
400 | InvalidRegionId.MalFormed | The specified RegionId is not valid. | 指定的地域不存在,請檢查該參數是否正確。 |
400 | InvalidOperation.InstanceTypeNotSupport | The instance type of the specified instance does not support hot detach disk. | 磁盤掛載的實例不支持磁盤熱插拔操作。 |
400 | DisksDetachingOnEcsExceeded | The number of disks detaching on the instance exceeds the limit. | 實例上正在卸載的磁盤個數超過限制 |
403 | IncorrectDiskStatus | The current disk status does not support this operation. | 當前的磁盤不支持此操作,請您確認磁盤處于正常使用狀態,是否欠費。 |
403 | DiskNotPortable | The specified disk is not a portable disk. | 指定的磁盤不是可卸載的磁盤,Portable 為 false 的磁盤無法卸載。 |
403 | InstanceLockedForSecurity | The instance is locked due to security. | 您的資源被安全鎖定,拒絕操作。 |
403 | DependencyViolation | The specified disk has not been attached on the specified instance. | 資源有其它依賴無法執行操作,請先將依賴取消關聯。如:指定磁盤沒有掛載在指定的實例上;指定安全組內有實例時無法刪除安全組等。 |
403 | DiskTypeViolation | The specified disk is a system disk and cannot support the operation. | 指定的云盤是系統盤,不能卸載。 |
403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | 該資源目前的狀態不支持此操作。 |
403 | UserNotInTheWhiteList | The user is not in disk white list. | 您不在磁盤白名單中,請加入白名單后重試。 |
403 | InvalidInstance.ImageCategory | The image category of the specified instance does not support detaching system disk. | 指定實例的鏡像狀態不支持卸載指定的系統盤??赡茉颍簞摻▽嵗龝r使用的鏡像被刪除。 |
403 | DeleteWithInstance.Conflict | Multi attach disk cannot be set to DeleteWithInstance attribute. | 開啟多重掛載特性的云盤不支持設置 DeleteWithInstance。 |
403 | InvalidOperation.DiskCategoryUnsupported | The DetachDisk operation is not supported for elastic ephemeral disk. | 彈性臨時盤不支持單獨卸載 |
403 | InvalidParameter.DeleteWithInstance | The DeleteWithInstance for the elastic ephemeral disk must be set to true. | 彈性臨時盤的 DeleteWithInstance 屬性必須設置為 true。 |
403 | InvalidOperation.DiskDetachingFromThisEcs | The specified disk is detaching from this ecs. | 磁盤正在從當前實例上卸載。 |
404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | 指定的實例ID未找到。 |
404 | InvalidDiskId.NotFound | The specified disk does not exist. | 指定的磁盤不存在。請您檢查磁盤 ID 是否正確。 |
404 | InvalidDisk.AlreadyDetached | The specified disk has been detached. | 指定的磁盤已分離。 |
404 | InvalidDiskId.OperationNotSupported | The operation is not supported due to base image not exist. | - |
500 | InternalError | The request processing has failed due to some unknown error. | 內部錯誤,請重試。 |
500 | InternalError | The request processing has failed due to some unknown error, exception or failure. | 內部錯誤,請重試。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
變更時間 | 變更內容概要 | 操作 |
---|---|---|
2024-09-20 | OpenAPI 錯誤碼發生變更 | 查看變更詳情 |
2024-07-24 | OpenAPI 錯誤碼發生變更 | 查看變更詳情 |
2024-05-09 | OpenAPI 錯誤碼發生變更 | 查看變更詳情 |
2024-04-15 | OpenAPI 錯誤碼發生變更 | 查看變更詳情 |
2023-11-24 | OpenAPI 錯誤碼發生變更 | 查看變更詳情 |