For the complete documentation index, see llms.txt. This page is also available as Markdown.

CreateDisks

1. API Description

This API (CreateDisks) is used to create one or more disks.

Notes

  • This interface is asynchronous. After the request to create disks is submitted successfully, a list of disk IDs is returned, but the creation is not completed immediately. The creation result can be queried through DescribeDisks. If the corresponding disk data can be queried and its status is AVAILABLE, the disk is created successfully. If attaching it to an instance was specified at creation, the status IN_USE indicates that the attachment succeeded.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

zoneId

Yes

String

ID of the availability zone that the disk belongs to.

It can be obtained by calling DescribeZones.

diskSize

Yes

Integer

Storage space.

Unit: GB.

instanceChargePostpaid

No

The commitment period for a postpaid cloud disk.

Only pass this when a commitment period needs to be specified.

diskName

No

String

Disk name.

Length: 1 to 64 characters.

Only letters, digits, hyphens (-), slashes (/), underscores (_) and periods (.) are allowed.

Must start and end with a digit or a letter.

Required when diskNames is not specified.

diskNames

No

Array of String

The individual name for each cloud disk.

The number of names must match the diskAmount field, and the naming rules are the same as diskName.

If not passed, all disks in this batch use the name specified by diskName.

diskAmount

No

Integer

Quantity of disks.

Value range: [1, 1000]

Default value: 1

instanceId

No

String

ID of the instance that the disk is attached to.

It can be obtained by calling DescribeInstances.

instanceIds

No

Array of String

IDs of the instances to be bound.

The quantity must be the same as the diskAmount field, and each disk is attached to a different instance. When it is passed together with instanceId, instanceId takes precedence.

It can be obtained by calling DescribeInstances.

resourceGroupId

No

String

Resource group ID.

If the value is null, the disk will be added into default resource group.

diskCategory

No

String

Disk category.

Basic NVMe SSD/BASIC_NVME_SSD: basic NVMe SSD.

Standard NVMe SSD/NVME_SSD: standard NVMe SSD.

Default value: Standard NVMe SSD

snapshotId

No

String

Create the disk from a snapshot ID.

If it is specified, the disk is created from this snapshot, and the disk type of the snapshot must be a data disk snapshot.

It can be obtained by calling DescribeSnapshots.

marketingOptions

No

Information on marketing campaigns.

tags

No

Bound tags when creating resources.

Tag keys must be unique.

burstingEnabled

No

Boolean

Whether to enable burstable performance.

Default value: false

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request.

RequestId is required for locating a problem.

diskIds

Array of String

ID list of disks.

orderNumber

String

Number of order.

4. Code Example

1. Create a 30 GiB disk.

2. Create three 20 GiB disks and attach them to the same instance.

3. Create two 20 GiB disks, attach them to two different instances, and specify a name for each of them.

4. Create a 30 GiB disk with a POC voucher. If no POC voucher exists in the system, the creation will fail.

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs,to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

HTTP Status Code
Error Code
Description

400

INVALID_DISK_CATEGORY_ZONE_NO_SELL

Disk type not for sale in the zone.

400

INVALID_DISK_SIZE_EXCEED_MAXIMUM

Disk size exceeds the maximum limit.

400

INVALID_DISK_SIZE_LESS_MINIMUM

Disk size should be larger than the minimum limit.

404

INVALID_DISK_SNAPSHOT_NOT_FOUND

Snapshot does not exist.

400

INVALID_DISK_SNAPSHOT_SIZE_MISMATCH

The capacity of the created disk is smaller than the source disk size of the snapshot.

404

INVALID_DISK_SNAPSHOT_ZONE_MISMATCH

The snapshot does not match the specified zone.

404

INVALID_INSTANCE_NOT_FOUND

Instance not found.

404

INVALID_INSTANCE_OR_ZONE_CANNOT_BE_BOTH_EMPTY

Specify at least one of the parameters: instance and zone.

400

INVALID_PARAMETER_DISK_NAME_MALFORMED

The disk name format is invalid.

400

INVALID_ZONE_MISMATCH

The zones mismatch.

404

INVALID_ZONE_NOT_FOUND

Region does not exist.

400

LIMIT_EXCEEDED_INSTANCE_CAN_ATTACH

Quantity of attached disks exceed available disk numbers of an instance.

400

OPERATION_DENIED_DISK_INSTANCE_NOT_ADAPTER

The number of instances does not match the number of disks.

400

OPERATION_DENIED_DISK_IO_BURST

The disk bursting function is not enabled.

400

OPERATION_DENIED_DISK_NAME_NOT_ADAPTER

The number of specified disk names does not match the number of disks to be created.

400

OPERATION_DENIED_DISK_SNAPSHOT_STATUS

The operation is not supported for current snapshot state.

400

OPERATION_DENIED_DISK_SYSTEM_TYPE

The operation is not supported for system disks.

400

UNSUPPORTED_OPERATION_INSTANCE_STATUS

Operations on instances in current state are not supported.

Last updated