Updated on 2024-02-27 GMT+08:00

Creating EVS Disks

Function

This API is used to create EVS disks.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/volumes

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

The project ID.

For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

The user token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

volume

Yes

CinderCreateVolumeOption object

The information of the disk to be created. Note: Specifying any two of the source_volid, snapshot_id, and imageRef fields together is not supported.

OS-SCH-HNT:scheduler_hints

No

CinderCreateVolumeSchedulerHints object

The scheduling parameter. The dedicated_storage_id field is supported, indicating that disks can be created in DSS storage pools.

Table 4 CinderCreateVolumeOption

Parameter

Mandatory

Type

Description

availability_zone

Yes

String

The AZ where you want to create the disk. If the specified AZ does not exist or is different from the AZ to which the backup belongs, the disk will fail to be created.

consistencygroup_id

No

String

The ID of the consistency group. If this parameter is specified, the disk belongs to this consistency group. This function is currently not available.

description

No

String

The disk description. You can enter up to 85 characters.

imageRef

No

String

The image ID. If this parameter is specified, the disk is created from an image.

NOTE:

Bare Metal Server (BMS) system disks cannot be created from BMS images. For details about how to obtain the image ID, see Querying Images.

metadata

No

VolumeMetadata object

The disk metadata. The length of key or value under metadata can contain no more than 255 bytes.

The metadata field only shows some parameters. You can specify other parameters based on your requirements.

value of a key-value pair in metadata cannot be null.

multiattach

No

Boolean

Whether the disk is shareable. The default value is false.

true: The disk is shareable.

false: The disk is not shareable.

For details, see

Shared EVS Disks and Usage Instructions.

name

No

String

The disk name. You can enter up to 64 characters.

size

No

Integer

The disk size, in GiB. The restrictions are as follows: System disk: 1 GiB to 1,024 GiB Data disk: 10 GiB to 32,768 GiB This parameter is mandatory when you create an empty disk.

If you create the disk from a snapshot, this parameter is mandatory, and the disk size must be greater than or equal to the snapshot size.

If you create the disk from an image, this parameter is mandatory, and the disk size must be greater than or equal to the minimum capacity required by the min_disk image attribute.

snapshot_id

No

String

The snapshot ID. If this parameter is specified, the disk is created from a snapshot.

source_replica

No

String

This parameter indicates that the disk is cloned from another disk. This function is currently not available.

source_volid

No

String

The source disk ID. If this parameter is specified, the disk is cloned from an existing disk. This function is currently not supported.

volume_type

Yes

String

The disk type.

The value can be SATA, SAS, GPSSD, SSD, ESSD, GPSSD2, or ESSD2.

  • SATA: the common I/O type

  • SAS: the high I/O type

  • GPSSD: the general purpose SSD type

  • SSD: the ultra-high I/O type

  • ESSD: the extreme SSD type

  • GPSSD2: the general purpose SSD V2 type

  • ESSD2: the extreme SSD V2 type If the specified disk type is not available in the AZ, the disk will fail to be created.

NOTE:

When you create a disk from a snapshot, ensure that the disk type of the new disk is consistent with that of the snapshot's source disk. For details about disk types, see

Disk Types and Performance.

Enumeration values:

  • ESSD2

  • GPSSD2

  • ESSD

  • SSD

  • GPSSD

  • SAS

  • SATA

iops

No

Integer

The configured IOPS. This parameter is mandatory only when a general purpose SSD V2 or an extreme SSD V2 disk is created.

NOTE:
  • To learn the IOPS ranges of general purpose SSD V2 and extreme SSD V2 disks, see the EVS performance data table in Disk Types and Performance.

  • Only pay-per-use billing is supported.

throughput

No

Integer

The configured throughput, in the unit of MiB/s. This parameter is mandatory only when a general purpose SSD V2 disk is created.

NOTE:

-To learn the throughput range of general purpose SSD V2 disks, see the EVS performance data table in Disk Types and Performance.

  • Only pay-per-use billing is supported.

Table 5 VolumeMetadata

Parameter

Mandatory

Type

Description

__system__cmkid

No

String

The encryption CMK ID in metadata. This parameter is used together with __system__encrypted for encryption. The length of cmkid is fixed at 36 bytes.

NOTE:

Use an HTTPS request to obtain the key ID. For details, see Querying the Key List.

__system__encrypted

No

String

The encryption field in metadata. The value can be 0 (no encryption) or 1 (encryption). If this parameter does not appear, the disk is not encrypted.

full_clone

No

String

If the disk is created from a snapshot and linked cloning needs to be used, set this parameter to 0.

hw:passthrough

No

String

If this parameter is set to true, the disk device type is SCSI, which allows ECS OSs to directly access the underlying storage media. SCSI reservation commands are supported.

If this parameter is set to false, the disk device type is VBD, which is also the default type. VBD supports only simple SCSI read/write commands.

If this parameter is not available, the disk device type is VBD.

Table 6 CinderCreateVolumeSchedulerHints

Parameter

Mandatory

Type

Description

dedicated_storage_id

No

String

The dedicated storage pool ID.

Response Parameters

Status code: 202

Table 7 Response body parameters

Parameter

Type

Description

volume

CreateVolumeDetail object

The created disk information.

Table 8 CreateVolumeDetail

Parameter

Type

Description

id

String

The disk ID.

links

Array of Link objects

The disk URI.

name

String

The disk name.

status

String

The disk status. For details, see EVS Disk Status.

attachments

Array of VolumeAttachment objects

The attachment information.

availability_zone

String

The AZ to which the disk belongs.

bootable

String

Whether the disk is bootable. true: The disk is bootable. false: The disk is not bootable.

encrypted

Boolean

This field is currently not supported.

created_at

String

The time when the disk was created.

Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX

description

String

The disk description.

volume_type

String

The disk type.

The value can be SATA, SAS, GPSSD, SSD, ESSD, GPSSD2, or ESSD2.

  • SATA: the common I/O type

  • SAS: the high I/O type

  • GPSSD: the general purpose SSD type

  • SSD: the ultra-high I/O type

  • ESSD: the extreme SSD type

  • GPSSD2: the general purpose SSD V2 type

  • ESSD2: the extreme SSD V2 type If the specified disk type is not available in the AZ, the disk will fail to be created.

replication_status

String

The reserved field.

consistencygroup_id

String

The ID of the consistency group where the disk belongs.

source_volid

String

The source disk ID.

This field is currently not supported.

snapshot_id

String

The snapshot ID.

metadata

VolumeMetadata object

The metadata.

size

Integer

The disk size, in GiB.

user_id

String

The ID of the user that uses the disk.

updated_at

String

The time when the disk was updated.

shareable

Boolean

Whether the disk is shareable. Note: This field has been deprecated. Use multiattach.

multiattach

Boolean

Whether the disk is shareable. true: The disk is shareable. false: The disk is not shareable.

storage_cluster_id

String

The reserved field.

Table 10 VolumeAttachment

Parameter

Type

Description

attached_at

String

The time when the disk was attached.

Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX

attachment_id

String

The attachment ID.

device

String

The device name.

host_name

String

The name of the physical host housing the cloud server to which the disk is attached.

id

String

The ID of the attached disk.

server_id

String

The ID of the server to which the disk is attached.

volume_id

String

The disk ID.

Table 11 VolumeMetadata

Parameter

Type

Description

__system__cmkid

String

The encryption CMK ID in metadata. This parameter is used together with __system__encrypted for encryption. The length of cmkid is fixed at 36 bytes.

NOTE:

Use an HTTPS request to obtain the key ID. For details, see Querying the Key List.

__system__encrypted

String

The encryption field in metadata. The value can be 0 (no encryption) or 1 (encryption). If this parameter does not appear, the disk is not encrypted.

full_clone

String

If the disk is created from a snapshot and linked cloning needs to be used, set this parameter to 0.

hw:passthrough

String

If this parameter is set to true, the disk device type is SCSI, which allows ECS OSs to directly access the underlying storage media. SCSI reservation commands are supported.

If this parameter is set to false, the disk device type is VBD, which is also the default type. VBD supports only simple SCSI read/write commands.

If this parameter is not available, the disk device type is VBD.

Status code: 400

Table 12 Response body parameters

Parameter

Type

Description

error

Error object

The error message returned if an error occurs.

Table 13 Error

Parameter

Type

Description

code

String

The error code returned if an error occurs.

For details about error codes and their meanings, see Error Codes.

message

String

The error message returned if an error occurs.

Example Requests

Creating an EVS disk (Use an image to create a non-shared EVS disk in the DSS storage pool. Set the disk type to common I/O, device type to SCSI, and disk size to 40 GiB.)

POST https://{endpoint}/v2/{project_id}/volumes

{
  "volume" : {
    "name" : "openapi_vol01",
    "imageRef" : "027cf713-45a6-45f0-ac1b-0ccc57ac12e2",
    "availability_zone" : "xxx",
    "description" : "create for api test",
    "volume_type" : "SATA",
    "metadata" : {
      "hw:passthrough" : "true"
    },
    "consistencygroup_id" : null,
    "source_volid" : null,
    "snapshot_id" : null,
    "multiattach" : false,
    "source_replica" : null,
    "size" : 40
  },
  "OS-SCH-HNT:scheduler_hints" : {
    "dedicated_storage_id" : "eddc1a3e-4145-45be-98d7-bf6f65af9767"
  }
}

Example Responses

Status code: 202

Accepted

{
  "volume" : {
    "attachments" : [ ],
    "availability_zone" : "xxx",
    "bootable" : "false",
    "created_at" : "2016-05-25T02:38:40.392463",
    "description" : "create for api test",
    "encrypted" : false,
    "id" : "8dd7c486-8e9f-49fe-bceb-26aa7e312b66",
    "links" : [ {
      "href" : "https://volume.localdomain.com:8776/v2/5dd0b0056f3d47b6ab4121667d35621a/volumes/8dd7c486-8e9f-49fe-bceb-26aa7e312b66",
      "rel" : "self"
    }, {
      "href" : "https://volume.localdomain.com:8776/5dd0b0056f3d47b6ab4121667d35621a/volumes/8dd7c486-8e9f-49fe-bceb-26aa7e312b66",
      "rel" : "bookmark"
    } ],
    "metadata" : {
      "__system__encrypted" : 0
    },
    "name" : "openapi_vol01",
    "replication_status" : "disabled",
    "multiattach" : false,
    "size" : 40,
    "status" : "creating",
    "user_id" : "39f6696ae23740708d0f358a253c2637",
    "volume_type" : "SATA"
  }
}

Status code: 400

Bad Request

{
  "error" : {
    "message" : "XXXX",
    "code" : "XXX"
  }
}

Status Codes

Status Code

Description

202

Accepted

400

Bad Request

Error Codes

See Error Codes.