Creating EVS Disks

Function

This API is used to create one or multiple EVS disks.

URI

  • URI format

    POST /v3/{project_id}/cloudvolumes

  • Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

Request

  • Request parameters

    Parameter

    Type

    Mandatory

    Description

    volume

    Object

    Yes

    The information of the disk to be created. For details, see Parameters in the volume field.

  • Parameters in the volume field

    Parameter

    Type

    Mandatory

    Description

    backup_id

    String

    No

    The backup ID. This parameter is mandatory when you create the disk from a backup.

    Note

    For how to obtain the backup ID, see Querying All Backups in the Cloud Backup and Recovery API Reference.

    availability_zone

    String

    Yes

    The AZ where you want to create the disk. If the specified AZ does not exist, the disk will fail to be created.

    Note

    For details about how to obtain the AZ, see Querying All AZs.

    description

    String

    No

    The disk description, which can contain a maximum of 255 bytes.

    size

    Integer

    Yes

    The disk size, in GB. The value can be as follows:

    • System disk: 1 GB to 1024 GB

    • Data disk: 10 GB to 32768 GB

    This parameter is mandatory when you create an empty disk. You can specify the parameter value as required within the value range.

    This parameter is mandatory when you create the disk from a snapshot. Ensure that the disk size is greater than or equal to the snapshot size.

    This parameter is mandatory when you create the disk from an image. Ensure that the disk size is greater than or equal to the minimum disk capacity required by min_disk in the image attributes.

    This parameter is optional when you create the disk from a backup. If this parameter is not specified, the disk size is equal to the backup size.

    Note

    If the specified value is a decimal, the number part of the value will be used.

    name

    String

    No

    The disk name.

    • If you create disks one by one, the name value is the disk name, which can contain a maximum of 255 characters.

    • If you create multiple disks (the count value greater than 1), the system will automatically add a hyphen followed by a four-digit incremental number, such as -0000, to the end of each disk name. For example, the disk names can be volume-0001 and volume-0002. The value can contain a maximum of 250 bytes.

    snapshot_id

    String

    No

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

    Note

    For details about how to obtain the snapshot ID, see Querying Details About EVS Snapshots.

    imageRef

    String

    No

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

    Note

    BMS system disks cannot be created from BMS images.

    For how to obtain the image ID, see Querying Images in the Image Management Service API Reference.

    volume_type

    String

    Yes

    The disk type.

    The value can be ESSD, SSD, SAS, SATA, co-p1, or uh-l1.

    • SSD: the ultra-high I/O type

    • SAS: the high I/O type

    • SATA: the common I/O type

    • co-p1: the high I/O (performance-optimized I) type

    • uh-l1: the ultra-high I/O (latency-optimized) type

    • ESSD: the extreme SSD type

      The co-p1 and uh-l1 types of disks are used exclusively for HPC ECSs and SAP HANA ECSs.

    If the specified disk type is not available in the AZ, the disk will fail to be created.

    Note

    • When the disk is created from a backup:

      If the type of the backup's source disk is SSD, SAS, SATA, or ESSD, you can create disks of any of these types.

      If the type of the backup's source disk is co-p1 or uh-l1, you can only create these two types of disks.

    • When the disk is created from a snapshot, the disk type of the new disk will be consistent with that of the snapshot's source disk.

    • For details about disk types, see Disk Types and Performance in the Elastic Volume Service User Guide.

    count

    Integer

    No

    The number of disks to be created in a batch. If this parameter is not specified, only one disk will be created. You can create a maximum of 100 disks in a batch.

    If disks are created from backups, batch creation is not supported, and this parameter must be set to 1.

    Note

    If the specified value is a decimal, the number part of the value will be used.

    shareable

    String

    No

    Whether the disk is shareable. The value can be true (shared disk) or false (common disk).

    Note

    This field is no longer used. Use multiattach.

    metadata

    Map<String,String>

    No

    The metadata of the disk to be created.

    Optional parameters:

    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.

    __system__encrypted: the encryption field in metadata. The value can be 0 (does not encrypt the disk) or 1 (encrypts the disk). If this parameter is not specified, the encryption attribute of the disk will be the same as that of the data source. If the disk is not created from a data source, the disk will not be encrypted by default.

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

    hw:passthrough:

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

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

    • If this parameter is not specified, the disk device type will be VBD.

    multiattach

    Boolean

    No

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

    • true: indicates a shared disk will be created.

    • false: indicates a non-shared disk will be created.

    tags

    Object

    No

    The tags to be added to the disk during the disk creation.

    A maximum of 10 tags can be created for a disk.

    Tag keys of a tag must be unique. Deduplication will be performed for duplicate keys. Therefore, only one tag key in the duplicate keys is valid.

    • Tag key: String type

      • Cannot be left blank.

      • Must be unique for each resource.

      • Can contain a maximum of 36 characters.

      • Can contain only digits, letters, hyphens (-), and underscores (_).

    • Tag value: String type

      • Can contain a maximum of 43 characters.

      • Can contain only digits, letters, hyphens (-), and underscores (_).

    Note

    Specifying either two of the backup_id, snapshot_id, and imageRef fields is not supported.

  • Example request

    {
        "volume": {
            "backup_id": null,
            "count": 1,
            "availability_zone": "az-dc-1",
            "description": "test_volume_1",
            "size": 120,
            "name": "test_volume_1",
            "volume_type": "SSD",
            "metadata": {
                "__system__encrypted": "1",
                "__system__cmkid": "37b0d52e-c249-40d6-83cb-2b93f22445bd"
            }
        }
    }
    

Response

  • Response parameters

    Parameter

    Type

    Description

    job_id

    String

    The task ID.

    error

    Object

    The error message returned if an error occurs. For details, see Parameters in the error field.

  • Parameters in the error field

    Parameter

    Type

    Description

    message

    String

    The error message returned if an error occurs.

    code

    String

    The error code returned if an error occurs.

    For details about the error code, see Error Codes.

  • Example response

    {
        "job_id": "70a599e0-31e7-49b7-b260-868f441e862b"
    }
    

    or

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

Status Codes

  • Normal

    200

Error Codes

For details, see Error Codes.