• Image Management Service

ims
  1. Help Center
  2. Image Management Service
  3. API Reference
  4. APIs
  5. Image (Extension APIs)
  6. Creating a Data Disk Image Using an External Image File

Creating a Data Disk Image Using 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. The API is an asynchronous one. If it is successfully called, the cloud service system receives the request. However, you need to use the asynchronous job query API to query the image creation status. For details, see Asynchronous Job Query.

URI

URI format

POST /v1/cloudimages/dataimages/action

Constraints

  • The OS type of the data disk image must be defined, and it can either Windows or Linux.
  • The data disk has about 40 GB to 2048 GB of storage space.
  • When uploading the external image file, you must select an OBS bucket with Standard storage.
  • A data disk image can be used only once during the creation of an ECS.

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Specifies the image name. For detailed parameter description, see Image Attributes.

    description

    No

    String

    Provides supplementary information about the image. For detailed description, see Image Attributes. The value contains a maximum of 1024 characters and consists of only letters and digits. Carriage returns and angle brackets (< >) are not allowed. This parameter is left blank by default.

    os_type

    Yes

    String

    Specifies the OS type.

    It can only be Windows or Linux.

    image_url

    Yes

    String

    Specifies the URL of the external image file in the OBS bucket.

    The format is OBS bucket name:Image file name.

    NOTICE:

    The storage class of the OBS bucket must be Standard.

    min_disk

    Yes

    Int

    Specifies the minimum size of the data disk.

    Value range: 40 GB to 2048 GB

    cmk_id

    No

    String

    Specifies the master key used for encrypting an image. For its value, see the Key Management Service User Guide.

    tags

    No

    List<String>

    Lists the image tags. For detailed parameter description, see Image Tag Data Formats.

    Use either tags or image_tags.

    image_tags

    No

    List<Map>

    Lists the image tags. For detailed parameter description, see Image Tag Data Formats. This parameter is left blank by default. Use either tags or image_tags.

  • Example requests
    • Request for creating an image (tags)
      POST /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"
      }
      
    • Request for creating an image (image_tags)
      POST /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

  • Parameter description

    Parameter

    Type

    Description

    job_id

    String

    Specifies the asynchronous job ID.

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

Returned Values

  • Normal

    200

  • Abnormal

    Returned Values

    Description

    400 Bad Request

    Request error. For details, see Error Codes.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    You do not have the rights to perform the operation.

    404 Not Found

    The requested resource was not found.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    The service is unavailable.