Creating EVS Disks

Function

This API contains all functions found in the API provided in Creating EVS Disks (Deprecated) and can also be used to create EVS disks billed in yearly/monthly mode. Enterprise project authorization is supported.

After a yearly/monthly-billed disk is successfully created by calling this API,
  • If you need to view the coupons available for your order, see Viewing Coupons Available for an Order.
  • If you need to pay for the order, see Paying for the Order of Yearly/Monthly-Billed Resources.
  • If you need to view the resource provisioning details in your order, see Querying Resource Provisioning Details in an Order.
  • If you need to unsubscribe from a yearly/monthly resource, see Unsubscribing from Year/Monthly Resources.

URI

  • URI format

    POST /v2.1/{project_id}/cloudvolumes

  • Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

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

Request

  • Parameter description

    Parameter

    Type

    Mandatory

    Description

    volume

    Object

    Yes

    Specifies the information of the disks to be created. For details, see Parameters in the volume field.

    bssParam

    Object

    No

    Specifies the extended parameters of the pay-per-use and yearly/monthly billing modes. For details, see Parameters in the bssParam field.

    OS-SCH-HNT:scheduler_hints

    Object

    No

    Specifies the scheduling parameter used to create disks. For details, see Parameter in the OS-SCH-HNT:scheduler_hints field.

    server_id

    String

    No

    Specifies the server you want to attach the disks.

  • Parameters in the volume field

    Parameter

    Type

    Mandatory

    Description

    backup_id

    String

    No

    Specifies the ID of the backup that can be used to create a disk. This parameter is mandatory when you use a backup to create the disk.

    NOTE:

    For how to obtain the backup ID, see Querying All Backups.

    availability_zone

    String

    Yes

    Specifies the AZ where you want to create the disk. If the AZ does not exist, the disk will fail to create.

    NOTE:

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

    description

    String

    No

    Specifies the disk description. The value can contain a maximum of 255 bytes.

    size

    Integer

    No

    Specifies the disk size, in GB. Its 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 parameter value is a decimal, the integral part of the value is used by default when the request is sent.

    name

    String

    No

    Specifies the disk name.

    • If you create disks one by one, the name value is the disk name. The value can contain a maximum of 255 bytes.
    • If you create multiple disks (the count value is greater than 1), the system automatically adds 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

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

    NOTE:

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

    imageRef

    String

    No

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

    NOTE:

    BMS system disks cannot be created from BMS images.

    For details about how to obtain the image ID, see Querying Images.

    volume_type

    String

    Yes

    Specifies the disk type.

    Currently, the value can be SSD, GPSSD, or SAS.
    • SSD: specifies the ultra-high I/O disk type.
    • GPSSD: specifies the general purpose SSD disk type.
    • SAS: specifies the high I/O disk type.

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

    NOTE:
    • If the disk is created from a snapshot, the volume_type field must be the same as that of the snapshot's source disk.
    • For details about disk types, see Disk Types and Disk Performance.

    count

    Integer

    No

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

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

    NOTE:

    If the specified parameter value is a decimal, the integral part of the value is used by default when the request is sent.

    metadata

    Object

    No

    Specifies the metadata of the created disk. The length of the key or value in the metadata cannot exceed 255 bytes.

    NOTE:

    Parameter values under metadata cannot be null.

    The following parameters in metadata are optional. They are supported only when you create disks.

    • __system__cmkid

      Specifies 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:

      For details about how to obtain the CMK ID, see Query the key list.

    • __system__encrypted

      Specifies the encryption field in metadata. The value can be 0 (not encrypted) or 1 (encrypted). If this parameter is not specified, the encryption attribute of the disk is the same as that of the data source. If the disk is not created from a data source, the disk is not 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 does not appear, the disk device type is VBD.

    multiattach

    Boolean

    No

    Specifies whether the disk is shareable. The default value is false.
    • true: specifies a shared disk.
    • false: specifies a non-shared disk.

    For details, see Shared EVS Disks and Usage Instructions.

    tags

    Object

    No

    Specifies the tags 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: A tag key contains no more than 36 characters.

      It consists of letters, digits, underscores (_), hyphens (-), and Unicode characters (\u4E00-\u9FFF).

    • Tag value: A tag value contains no more than 43 characters and can be an empty string.

      It consists of letters, digits, underscores (_), periods (.), hyphens (-), and Unicode characters (\u4E00-\u9FFF).

    enterprise_project_id

    String

    No

    Specifies the enterprise project ID. This ID is associated with the disk during the disk creation.

    If it is not specified or set to 0, the resource is bound to the default enterprise project.

    NOTE:

    For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide.

    • Specifying either two of the backup_id, snapshot_id, and imageRef fields is not supported.
    • When creating disks, you can only specify the fields of metadata listed in the preceding table.
      • If the disk is created from a snapshot, __system__encrypted and __system__cmkid are not supported, and the newly created disk has the same encryption attribute as that of the snapshot's source disk.
      • If the disk is created from an image, __system__encrypted and __system__cmkid are not supported, and the newly created disk has the same encryption attribute as that of the image.
      • If the disk is created from a snapshot, hw:passthrough is not supported, and the newly created disk has the same device type as that of the snapshot's source disk.
      • If the disk is created from an image, hw:passthrough is not supported, and the device type of newly created disk is VBD.
  • Parameters in the bssParam field

    Parameter

    Type

    Mandatory

    Description

    chargingMode

    String

    No

    • Specifies the billing mode. The default value is postPaid.
    • Value range
      • prePaid: indicates the yearly/monthly billing mode.
      • postPaid: indicates the pay-per-use billing mode.

    periodType

    String

    No

    • Specifies the unit of the subscription term. This parameter is valid and mandatory only when chargingMode is set to prePaid.
    • Value range
      • month: indicates that the unit is month.
      • year: indicates that the unit is year.

    periodNum

    Integer

    No

    • Specifies the subscription term. This parameter is valid and mandatory only when chargingMode is set to prePaid.
    • Value range
      • When periodType is set to month, the parameter value ranges from 1 to 9.
      • When periodType is set to year, the parameter value must be set to 1.

    isAutoPay

    String

    No

    • Specifies whether to pay immediately. This parameter is valid only when chargingMode is set to prePaid. The default value is false.
    • Value range
      • false: indicates not to pay immediately after an order is created.
      • true: indicates to pay immediately after an order is created. The system will automatically deduct fees from the account balance.

    isAutoRenew

    String

    No

    • Specifies whether to automatically renew the subscription. This parameter is valid only when chargingMode is set to prePaid. The default value is false.
    • Value range
      • false: indicates not to automatically renew the subscription.
      • true: indicates to automatically renew the subscription. The automatic renewal term is the same as the subscription term.
  • Parameter in the OS-SCH-HNT:scheduler_hints field

    Parameter

    Type

    Mandatory

    Description

    dedicated_storage_id

    String

    No

    Specifies the DSS storage pool ID. If this parameter is specified, the disks will be created in this storage pool.

  • Example request
    {
        "volume": {
            "name": "test_volume_3", 
            "availability_zone": "cn-north-1a", 
            "volume_type": "SATA", 
            "size": 120, 
            "description": "hehehe", 
            "multiattach": true, 
            "count": 1
        }, 
        "bssParam": {
            "chargingMode": "prePaid", 
            "periodType": "year", 
            "periodNum": 1, 
            "isAutoPay": "true", 
            "isAutoRenew": "true"
        }
    }

Response

  • Parameter description

    Parameter

    Type

    Description

    job_id

    String

    Specifies the task ID. This parameter is returned when the created disk is billed in pay-per-use mode.

    NOTE:

    For details about how to query the task status, see Querying Task Status.

    order_id

    String

    Specifies the order ID. This parameter is returned when the created disk is billed in yearly/monthly mode.

    NOTE:
    • If you need to pay for the order, see Paying for the Order of Yearly/Monthly-Billed Resources.
    • If you need to view the resource provisioning details in your order, see Querying Resource Provisioning Details in an Order.
    • If you need to unsubscribe from a yearly/monthly resource, see Unsubscribing from Year/Monthly Resources.

    error

    Object

    Specifies the error message returned when an error occurs. For details, see Parameters in the error field.

    volume_ids

    Array of strings

    Specifies the IDs of the disks to be created.

  • Parameters in the error field

    Parameter

    Type

    Description

    message

    String

    Specifies the error message returned when an error occurs.

    code

    String

    Specifies the error code returned when an error occurs.

    For details about the error code, see Error Codes.

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

    or

    {
        "order_id": "CS1711152257C60TL"
    }

    or

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

Status Codes

  • Normal

    202

Error Codes

For details, see Error Codes.