DetachDisk - 卸载按量付费数据盘或系统盘

更新时间:
复制 MD 格式

从一台ECS实例上卸载一块按量付费的数据盘或者系统盘。

接口说明

调用该接口时,请注意:

  • 该接口为异步操作,调用成功后等待一分钟左右才能完成卸载。

  • 所挂载的实例被安全控制后,OperationLocks中不能标记为"LockReason" : "security"的锁定状态。

  • 弹性临时盘一旦卸载,只能重新挂载至其原始实例。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

ecs:DetachDisk

update

*Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

请求参数

名称

类型

必填

描述

示例值

InstanceId

string

待卸载的磁盘所绑定的 ECS 实例 ID。

i-bp67acfmxazb4p****

DiskId

string

待卸载的磁盘 ID。

  • 磁盘必须已经挂载到实例上,状态为使用中(In_use)。

  • 卸载数据盘时,所挂载的实例必须处于运行中(Running)或者已停止(Stopped)状态。

  • 卸载系统盘时,所挂载的实例必须处于已停止(Stopped)状态。

d-bp67acfmxazb4p****

DeleteWithInstance

boolean

卸载系统盘或数据盘时,设置自动释放属性。表示释放 ECS 实例时,是否同时释放该系统盘或数据盘。

  • true:释放。

  • false:不释放。云盘被转换为按量付费数据盘被保留下来。

默认值:true

您需要注意:

  • 开启多重挂载特性的云盘,不支持设置该参数。

  • 如果卸载的是数据盘,默认值为false

  • 若您需要卸载的目标磁盘为弹性临时盘,则必须将DeleteWithInstance参数设置为true

false

返回参数

名称

类型

描述

示例值

object

RequestId

string

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

示例

正常返回示例

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. 实例上正在卸载的磁盘个数超过限制
400 InvalidInstanceId.Malformed The specified parameter InstanceId is not valid. 指定的参数InstanceId格式有误。
500 InternalError The request processing has failed due to some unknown error.
403 IncorrectDiskStatus The current disk status does not support this operation.
403 DiskNotPortable The specified disk is not a portable disk.
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. 指定实例的镜像状态不支持卸载指定的系统盘。可能原因:创建实例时使用的镜像被删除。
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.
429 Throttling The request was denied due to request throttling. Please retry later.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情