Help Center/ Image Management Service/ API Reference/ IMS APIs/ Image/ Creating a Data Disk Image from an External Image File
Updated on 2026-07-07 GMT+08:00

Creating a Data Disk Image from an External Image File

Function

This API is used to create a data disk image from a data disk image file uploaded to the OBS bucket. This is an asynchronous API. A successful call only means the background has received the request. To see if an image is created successfully, you need to use the asynchronous job query API to query the image creation status. For details, see Querying the Progress of an Asynchronous Job.

Huawei Cloud has stopped providing Windows images. This API will no longer be used to create Windows data disk images using external files.

Debugging

You can debug this API in API Explorer.

Authorization

Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned. For details about the required permissions, see Permissions and Supported Actions.

URI

POST /v1/cloudimages/dataimages/action

Request

  • Request parameters

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Definition

    Image name. For details about name, see Image Attributes.

    Constraints

    • A name cannot start or end with a space.
    • The name length must be 1 to 128 characters.

    Range

    A name can contain only letters, digits, spaces, hyphens (-), underscores (_), and periods (.), and cannot start or end with a space.

    Default Value

    N/A

    description

    No

    String

    Definition

    Image description. For details about description, see Image Attributes.

    Constraints

    The value contains a maximum of 1,024 characters, including letters and digits. Carriage returns and angle brackets (< >) are not allowed.

    Range

    N/A

    Default Value

    N/A

    os_type

    No

    String

    Definition

    OS type.

    Constraints

    N/A

    Range

    Windows or Linux

    Default Value

    The default value is Linux.

    image_url

    Yes

    String

    Definition

    URL of the external image file in an OBS bucket.

    Constraints

    This parameter is mandatory if an external image file in an OBS bucket is used to create an image. The format is <OBS-bucket-name>:<image-file-name>.

    NOTE:

    The storage class of the OBS bucket and image files in it must be Standard.

    Range

    N/A

    Default Value

    N/A

    min_disk

    Yes

    Integer

    Definition

    Minimum data disk size.

    Constraints

    N/A

    Range

    For Linux, the value ranges from 10 GB to 1024 GB. For Windows, the value ranges from 20 GB to 1024 GB.

    Default Value

    N/A

    cmk_id

    No

    String

    Definition

    Custom key used to encrypt an image.

    Constraints

    N/A

    Range

    For details, see Key Management Service User Guide.

    Default Value

    N/A

    tags

    No

    Array of strings

    Definition

    Image tags. For details about tag, see Image Tag Format.

    Constraints

    Use either tags or image_tags.

    Range

    • A tag key can contain letters, digits, spaces, underscores (_), periods (.), colons (:), plus signs (+), hyphens (-), and at signs (@), but cannot start or end with a space or start with sys_.
    • A tag value can contain letters, digits, spaces, underscores (_), periods (.), colons (:), slashes (/), plus signs (+), hyphens (-), and at signs (@), but cannot start or end with a space.

    Default Value

    N/A

    image_tags

    No

    Array of ImageTag objects

    Definition

    Image tags (new format). For details about image_tags, see Table 1.

    Constraints

    Use either tags or image_tags.

    Range

    • A tag key can contain letters, digits, spaces, underscores (_), periods (.), colons (:), plus signs (+), hyphens (-), and at signs (@), but cannot start or end with a space or start with sys_.
    • A tag value can contain letters, digits, spaces, underscores (_), periods (.), colons (:), slashes (/), plus signs (+), hyphens (-), and at signs (@), but cannot start or end with a space.

    Default Value

    N/A

    enterprise_project_id

    No

    String

    Definition

    Enterprise project that an image belongs to.

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

    Constraints

    If only enterprise project authorization is used, the enterprise_project_id parameter must be specified. Otherwise, an error may occur, indicating that you do not have the required permissions.

    Range

    • If the value is 0 or left blank, the image belongs to the default enterprise project.
    • If the value is a UUID, the image belongs to the enterprise project corresponding to the UUID.

    Default Value

    N/A

    Table 1 Data structure description of the image_tags field

    Parameter

    Mandatory

    Type

    Description

    key

    No

    string

    Definition

    Tag key.

    Constraints

    The length cannot exceed 128 characters.

    Range

    A tag key can contain letters, digits, spaces, underscores (_), periods (.), colons (:), plus signs (+), hyphens (-), and at signs (@), but cannot start or end with a space or start with sys_.

    Default Value

    N/A

    value

    No

    string

    Definition

    Tag value.

    Constraints

    The length cannot exceed 255 characters.

    Range

    A tag value can contain letters, digits, spaces, underscores (_), periods (.), colons (:), slashes (/), plus signs (+), hyphens (-), and at signs (@), but cannot start or end with a space.

    Default Value

    N/A

Example Request

  • Creating a data disk image with parameter tags using a file in an OBS bucket (file address in the bucket: image-test:fedora_data1.qcow2; OS: Linux; minimum size of the data disk: 40 GB)
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    POST https://{Endpoint}/v1/cloudimages/dataimages/action
    {
      "name": "fedora-data1",
      "image_url": "image-test:fedora_data1.qcow2",
      "description":"Data disk 1 of Fedora",
      "min_disk": 40,
      "tags": [
        "aaa.111",
        "bbb.222"
      ],
      "os_type": "Linux"
    }
    
  • Creating a data disk image with parameter image_tags using a file in an OBS bucket (file address in the bucket: image-test:fedora_data1.qcow2; OS: Linux; minimum size of the data disk: 40 GB)
    1
    2
    3
    4
    5
    6
    7
    8
    9
    POST https://{Endpoint}/v1/cloudimages/dataimages/action
    {
      "name": "fedora-data2",
      "image_url": "image-test:fedora_data1.qcow2",
      "description":"Data disk 2 of Fedora",
      "min_disk": 40,
      "image_tags": [{"key":"aaa","value":"111"},{"key":"bbb","value":"222"}],
      "os_type": "Linux"
    }
    

Response

  • Response parameters

    Parameter

    Type

    Description

    job_id

    String

    Definition

    Asynchronous job ID.

    For details, see Querying the Progress of an Asynchronous Job.

    Range

    N/A

  • Example response
    STATUS CODE 200
    1
    2
    3
    {
        "job_id": "4010a32b5f909853015f90aaa24b0015"
    }
    

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error. For details about the returned error code, see Error Codes.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    Insufficient permissions.

    404 Not Found

    Requested resource not found.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    Service unavailable.