Importing an Image File Quickly
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 an image file 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 Querying the Status of an Asynchronous Job.
Huawei Cloud has stopped providing Windows images. This API will no longer be used to quickly import Windows images.
Constraints
- RAW image files have been optimized, and bitmap files have been generated.
- ZVHD2 image files have been optimized as required.
For details about how to convert the image file format and generate a bitmap file, see Quickly Importing an Image File.
URI
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 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_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.
license_type
No
String
Specifies the license type of the OS. The value can be:
platform: license provided by Huawei Cloud
byol: Bring Your Own License
Currently, this parameter is only available for 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.
NOTE:The storage class of the OBS bucket must be Standard.
min_disk
Yes
Integer
Specifies the minimum size (GB) of the system disk.
- This parameter is mandatory if an external image file in the OBS bucket is used to create an image.
- The value must be greater than the size of the selected image file. For Linux, the value ranges from 10 GB to 1,024 GB. For Windows, the value ranges from 20 GB to 1,024 GB.
tags
No
Array of strings
Lists the image tags. This parameter is left blank by default.
Set either tags or image_tags.
image_tags
No
Array of objects
Lists the image tags. This parameter is left blank by default.
Set either tags or image_tags.
For details about image_tags, see Table 1.
type
No
String
Specifies the image type. The parameter value is ECS/BMS for system disk images. The default value is ECS.
enterprise_project_id
No
String
Specifies the enterprise project that the image belongs to.
- 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.
For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Center.
architecture
No
String
Specifies the image architecture type. Available values include:
- x86
- arm
The default value is x86.
NOTE:If the image architecture is ARM, the boot mode is automatically changed to UEFI.
- Parameters description when an image file uploaded to the OBS bucket is used to create an 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
No
String
Specifies the OS version.
When a data disk image created, the value can be Linux or Windows. The default is Linux.
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.
NOTE:The storage class of the OBS bucket must be Standard.
min_disk
Yes
Integer
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. For Linux, the value ranges from 10 GB to 1,024 GB. For Windows, the value ranges from 20 GB to 1,024 GB.
tags
No
Array of strings
Lists the image tags. This parameter is left blank by default.
Set either tags or image_tags.
image_tags
No
Array of objects
Lists the image tags. This parameter is left blank by default.
Set either tags or image_tags.
For details about image_tags, see Table 1.
type
Yes
String
Specifies the image type. The parameter value is DataImage for data disk images.
enterprise_project_id
No
String
Specifies the enterprise project that the image belongs to.
- 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.
For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Center.
Example Request
- Creating a system disk image with parameter tags using a file in an OBS bucket (file address in the bucket: ims-image:centos70.zvhd2)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
POST https://{Endpoint}/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" ] }
- Creating a system disk image with parameter image_tags using a file in an OBS bucket (file address in the bucket: ims-image:centos70.zvhd2)
1 2 3 4 5 6 7 8 9 10
POST https://{Endpoint}/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 with parameter tags using a file in an OBS bucket (file address in the bucket: ims-image:centos70.zvhd2)
1 2 3 4 5 6 7 8 9 10 11 12 13 14
POST https://{Endpoint}/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_type": "Linux", "min_disk": 40, "type": "DataImage", "tags": [ "aaa.111", "bbb.333", "ccc.444" ] }
- Creating a data disk image with parameter image_tags using a file in an OBS bucket (file address in the bucket: ims-image:centos70.zvhd2)
1 2 3 4 5 6 7 8 9 10
POST https://{Endpoint}/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_type": "Linux", "min_disk": 40, "type": "DataImage", "image_tags": [{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}] }
Response
- Response parameters
Parameter
Type
Description
job_id
String
Specifies the asynchronous job ID.
For details, see Querying the Status of an Asynchronous Job.
- Example response
STATUS CODE 200
1 2 3
{ "job_id": "8a12fc664fb4daa3014fb4e581380005" }
Returned Values
- Normal
- Abnormal
Return Value
Description
400 Bad Request
Request error. For details about the returned error code, 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot