• Image Management Service

ims
  1. Help Center
  2. Image Management Service
  3. API Reference
  4. APIs
  5. Image (Extension APIs)
  6. Creating an Image from an Image File Using the Fast Image Creation Function

Creating an Image from an Image File Using the Fast Image Creation Function

Function

This API is used to quickly create a private image from an oversized external image file that has uploaded to the OBS bucket. Currently, only ZVHD2 and RAW image files are supported, and the size of image files cannot exceed 1 TB.

The fast image creation function is only available for image files in RAW or ZVHD2 format. For other formats of image files that are smaller than 128 GB, you are advised to import these files with the common method.

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.

Constraints

Before importing image files, ensure that the file format is RAW or ZVHD2 and the following have been done:
  • For Raw image files, bitmap files have been generated and uploaded to the OBS bucket together with the image files.
  • For ZVHD2 image files, they have been optimized as required.

For how to convert image file formats and generate a bitmap file, see section "Quickly Importing an Image File" in the Image Management Service User Guide.

URI

URI format

POST /v2/cloudimages/quickimport/action

Request

  • Parameters in the request body when an image file is used to create a system disk image

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Specifies the image name. For details about the name parameter, 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_version

    Yes

    String

    Specifies the OS version.

    This parameter is valid if an external image file uploaded to the OBS bucket is used to create an image. For its value, see Values of Related Parameters.

    image_url

    Yes

    String

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

    This parameter is mandatory if an external image file in the OBS bucket is used to create an image. 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 system disk in the unit of GB.

    This parameter is mandatory if an external image file in the OBS bucket is used to create an image. The value ranges from 1 to 1024.

    tags

    No

    List<String>

    Lists the image tags.

    type

    No

    String

    Specifies the image type. The parameter value is ECS/BMS for system disk images. The default value is ECS.

  • Parameters in the request body when an image file is used to create a data disk image

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Specifies the image name. For detailed 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 version.

    This parameter is used when a data disk image is to be created. The value can be Linux or Windows.

    image_url

    Yes

    String

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

    This parameter is mandatory if an external image file in the OBS bucket is used to create an image. 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 system disk in the unit of GB.

    This parameter is mandatory if an external image file in the OBS bucket is used to create an image. The value ranges from 1 to 1024.

    tags

    No

    List<String>

    Lists the image tags.

    type

    Yes

    String

    Specifies the image type. The parameter value is DataImage for data disk images.

  • Example requests
    • Creating a system disk image using an external image file
      POST /v2/cloudimages/quickimport/action
      {  
          "name": "ims_test_file",  
         "description": "Create an image using a file in the OBS bucket.", 
          "image_url": "ims-image:centos70.zvhd2",  
          "os_version": " CentOS 7.0 64bit",  
          "min_disk": 40,  
          "type": "ECS", 
          "tags":[    
                    "aaa.111",    
                    "bbb.333",    
                    "ccc.444"    
                ]       
        }
      POST /v2/cloudimages/quickimport/action
      {  
          "name": "ims_test_file",  
         "description": "Create an image using a file in the OBS bucket.", 
          "image_url": "ims-image:centos70.zvhd2",  
          "os_version": " CentOS 7.0 64bit",  
          "min_disk": 40,  
          "type":"ECS", 
       "image_tags":[{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}]  
        }
    • Creating a data disk image using an external image file
      POST /v2/cloudimages/quickimport/action
      {  
          "name": "ims_test_file",  
         "description": "Create an image using a file in the OBS bucket.", 
          "image_url": "ims-image:centos70.qcow2",  
          "os_type": "Linux",  
          "min_disk": 40,  
         "type": "DataImage",  
          "tags":[    
                    "aaa.111",    
                    "bbb.333",    
                    "ccc.444"    
                ]       
        }
      POST /v2/cloudimages/quickimport/action
      {  
          "name": "ims_test_file",  
         "description": "Create an image using a file in the OBS bucket.", 
          "image_url": "ims-image:centos70.qcow2",  
          "os_type": "Linux",  
          "min_disk": 40,  
          "type": "DataImage",  "image_tags":[{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}]  
        }

Response

  • Parameter description

    Parameter

    Type

    Description

    job_id

    String

    Specifies the asynchronous job ID.

  • Example response
    STATUS CODE 200
    { 
         "job_id": "8a12fc664fb4daa3014fb4e581380005" 
     }

Returned Values

  • Normal

    200

  • Abnormal

    Return Value

    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.