ModifyDiskAttribute - 修改块存储属性

更新时间:
复制 MD 格式

修改一个或多个块存储设备的名称、描述、是否随实例释放、是否随磁盘删除其自动快照、是否启用自动快照策略、是否开启性能突发功能等。

接口说明

您可以调用DiskId参数修改一个块存储设备的名称、描述、是否随实例释放等属性,调用DiskIds.N参数批量修改多个块存储设备的属性。

调试

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

调试

授权信息

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

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

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

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

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

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

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

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

操作

访问级别

资源类型

条件关键字

关联操作

ecs:ModifyDiskAttribute

update

*Disk

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

无 无

请求参数

名称

类型

必填

描述

示例值

DiskId

string

否

待修改属性的磁盘 ID。

说明

DiskId和DiskIds.N两个参数不能同时被调用,请您根据需求任选其一传值。

d-bp1famypsnar20bv****

DiskName

string

否

磁盘名称。长度为 2~128 个字符,支持 Unicode 中 letter 分类下的字符(其中包括英文、中文和数字等)。可以包含半角冒号(:)、下划线(_)、半角句号(.)或者短划线(-)。

MyDiskName

Description

string

否

磁盘描述。 长度为 2~256 个英文或中文字符,不能以http://和https://开头。

TestDescription

DeleteWithInstance

boolean

否

磁盘是否随实例释放。默认值:无,无表示不改变当前的值。

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

在下列两种情况下,将参数DeleteWithInstance设置成false时会报错。

  • 磁盘的种类(category)为本地盘(ephemeral)时。

  • 磁盘的种类(category)为普通云盘(cloud),且不可以卸载(Portable=false)时。

警告 如果您设置了不随实例释放(DeleteWithInstance=false),一旦磁盘挂载的 ECS 实例被安全锁定且 OperationLocks 中标记了"LockReason" : "security"的锁定状态,释放实例时会忽略磁盘的 DeleteWithInstance 属性而被同时释放。

false

DeleteAutoSnapshot

boolean

否

删除磁盘时,是否同时删除其自动快照。取值范围:

  • true:启用。

  • false:关闭。

默认值:无,无表示不改变当前的值。

false

EnableAutoSnapshot deprecated

boolean

否

磁盘是否启用自动快照策略功能。取值范围:

  • true:启用。

  • false:关闭。

默认值:无,表示不改变当前的值。

说明

该参数已弃用。创建后的云盘默认启用自动快照策略功能,您只需要为云盘绑定自动快照策略即可正常使用。

true

RegionId

string

是

地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。

cn-hangzhou

DiskIds

array

否

待修改多个磁盘的 ID 列表。N 的取值范围为 0 ~ 100。

说明

DiskId和DiskIds.N两个参数不能同时被调用,请您根据需求任选其一传值。

["d-bp1famypsnar20bv****"]

string

否

待修改多个磁盘的 ID。N 的取值范围为 0 ~ 100。

说明

DiskId和DiskIds.N两个参数不能同时被调用,请您根据需求任选其一传值。

d-bp1famypsnar20bv****

BurstingEnabled

boolean

否

针对支持 Burst(性能突发)的磁盘是否开启此功能,取值范围:

  • true:是。

  • false:否。

说明

对于不支持 Burst 功能的磁盘,传入任意值将会报错。

false

返回参数

名称

类型

描述

示例值

object

RequestId

string

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

示例

正常返回示例

JSON格式

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

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidDiskName.Malformed The specified DiskName is malformed. Please ensure that the DiskName is 2 to 128 characters long and does not start with "http://" or "https://" and try again.
400 NoAttributeToModify No attribute to be modified in this request.
400 IncompleteParamter Some required parameters are missing in this request. Please check the required parameters and try again.
400 InvalidRegionId.MalFormed The specified RegionId is not valid. Please verify the format of RegionId or call DescribeRegions to query the supported regions and try again. 指定的RegionId不合法。请检查RegionId格式或调用DescribeRegions查询支持的地域后重试。
400 MissingParameter.DiskIdOrDiskIds Either DiskId or DiskIds must be specified. Please specify one of them and try again.
400 ParameterConflict.DiskIdAndDiskIds The parameters DiskId and DiskIds are mutually exclusive. Please specify only one.
400 BurstingEnabledForDiskCategoryUnsupported The parameter BurstingEnabled is not supported for the category of the specified disk. Please remove BurstingEnabled or call ModifyDiskSpec to change the disk category to a supported value such as cloud_auto and try again.
400 BurstingEnabledForMultiAttachDiskUnsupported The parameter BurstingEnabled is not supported for multi-attach disks. Please disable bursting or use a disk without multi-attach enabled and try again.
400 BurstingEnabledForModifyingDiskUnsupported Bursting is not supported while the disk is in the Modifying state. Please wait until the modification completes and try again.
400 InvalidBurstingEnabled.DiskSizeTooSmall The specified disk size is too small to enable the bursting feature. Please use a disk of at least 4 GiB or disable BurstingEnabled and try again.
400 InvalidParameter.DeleteWithInstance The specified disk is an elastic ephemeral disk. Set "DeleteWithInstance" to true and try again.
403 QuotaExceed.Snapshot The snapshot quota exceeds.
403 DiskNotPortable The specified disk is not a portable disk.
403 IncorrectDiskStatus The current disk status does not support this operation. Please ensure the disk is in the In_use or Available state and try again.
403 UserNotInTheWhiteList The current account is not in the allowlist for this operation. Please submit a ticket to apply for access.
403 DeleteWithInstance.Conflict The specified image is from the image market. You cannot set the DeleteWithInstance attribute to false.
404 InvalidDiskId.NotFound The specified disk does not exist. Please verify the DiskId and the current region and try again.
404 InvalidDescription.Malformed The specified parameter Description is not valid. Please ensure that the description is 2 to 256 characters long and does not start with "http://" or "https://" and try again. 指定的参数Description无效。请确保描述信息长度为2 ~ 256个英文或中文字符,且不能以"http://"或"https://"开头,然后重试。
404 InvalidInstanceId.NotFound The instance to which the specified disk is attached does not exist. Please verify the DiskId or DiskIds and the current region and try again.

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

变更历史

更多信息,参考变更详情。