All Products
Search
Document Center

:ModifyDiskAttribute

最終更新日:Dec 18, 2023

Modifies the attributes of block storage devices, including their names, descriptions, and whether to release the devices together with their associated instances.

Usage notes

  • When you call this operation to modify the attributes of a disk, if you set DeleteWithInstance to false and the instance to which the disk is attached is locked for security reasons, the DeleteWithInstance settings of the disk are ignored and the disk will be released together with the instance. If "LockReason" : "security" is displayed in the response when you query the information about an instance, the instance is locked for security reasons.
  • You can use the DiskIds.N parameter to specify multiple block storage devices so that you can modify the attributes of the devices at a time, including their names, descriptions, and whether to release the devices together with their associated instances.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes ModifyDiskAttribute

The operation that you want to perform. Set the value to ModifyDiskAttribute.

DiskId String No d-bp1famypsnar20bv****

The ID of the disk.

Note DiskId and DiskIds.N are mutually exclusive. Specify one of the parameters based on your business requirements.
DiskName String No MyDiskName

The name of the disk. The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (_), and hyphens (-).

Description String No TestDescription

The description of the disk. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

DeleteWithInstance Boolean No false

Specifies whether to release the disk together with the associated instance. This parameter is empty by default, which indicates that the current value remains unchanged.

An error is returned if you set DeleteWithInstance to false in one of the following cases:

  • The disk is a local disk.
  • The disk is a basic disk and is not removable. If the Portable attribute of a disk is set to false, the disk is not removable.
DeleteAutoSnapshot Boolean No false

Specifies whether to delete the automatic snapshots of the disk when the disk is released. This parameter is empty by default, which indicates that the current value remains unchanged.

EnableAutoSnapshot Boolean No true

Specifies whether to enable the automatic snapshot policy feature for the cloud disk. Valid values:

  • true
  • false

This parameter is empty by default, which indicates that the current value remains unchanged.

Note By default, the automatic snapshot policy feature is enabled for cloud disks. You only need to associate an automatic snapshot policy with a cloud disk before you can use the policy.
RegionId String Yes cn-hangzhou

The region ID of the disk. You can call the DescribeRegions operation to query the most recent region list.

DiskIds.N String No d-bp1famypsnar20bv****

The ID of disk N. Valid values of N: 0 to 100.

Note DiskId and DiskIds.N are mutually exclusive. Specify one of the parameters based on your business requirements.
BurstingEnabled Boolean No false

Specifies whether to enable the performance burst feature. Valid values:

  • true
  • false

Response parameters

Parameter

Type

Example

Description

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ModifyDiskAttribute
&RegionId=cn-hangzhou
&DiskId=d-bp1famypsnar20bv****
&DiskName=MyDiskName
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidDiskName.Malformed The specified disk name is wrongly formed. Invalid DiskName format. The name must be 2 to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter and cannot start with http:// or https://.
400 NoAttributeToModify No attribute to be modified in this request. No attributes of the block storage device are modified.
400 IncompleteParamter Some fields can not be null in this request. Some required parameters are not specified.
400 InvalidRegionId.MalFormed The specified RegionId is not valid. Invalid RegionId value.
400 BurstingEnabledForDiskCategoryUnsupported The specified disk category does not support bursting enabled. The disk category does not support the performance burst feature.
400 BurstingEnabledForMultiAttachDiskUnsupported The multi attach disk does not support bursting enabled. Disks for which the multi-attach feature is enabled do not support the performance burst feature.
400 BurstingEnabledForModifyingDiskUnsupported The modifying disk does not support bursting enabled. You cannot modify the performance burst feature for a disk whose configurations are changed.
403 QuotaExceed.Snapshot The snapshot quota exceeds. The maximum number of snapshots is reached. To store new snapshots, delete snapshots that you no longer need.
403 DiskNotPortable The specified disk is not a portable disk. The specified disk is not removable.
403 IncorrectDiskStatus The operation is not supported in this status. This operation cannot be performed on the disk in the current state. Make sure that the disk is available and that you have no overdue payments for it.
403 UserNotInTheWhiteList The user is not in disk white list. You are not authorized to manage the disk. Try again after you are authorized.
403 DeleteWithInstance.Conflict Multi attach disk cannot be set to DeleteWithInstance attribute. Disks for which the multi-attach feature is enabled do not support the DeleteWithInstance attribute.
404 InvalidDiskId.NotFound The specified disk does not exist. This disk is not found. Check whether the disk ID is valid.
404 InvalidDescription.Malformed The specified description is wrongly formed. Invalid Description format. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
404 InvalidInstanceId.NotFound Specified attached instance does not exist. The specified instance is not found. Check whether the instance ID is correct.

For a list of error codes, see Service error codes.