This API is used to create a private image. The following methods are supported:
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.
You cannot export public images (such as Windows, SUSE Linux, Red Hat Linux, Oracle Linux, and Ubuntu) or private images created using these public images.
POST /v2/cloudimages/action
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Specifies the name of the system disk image. For detailed description, see Image Attributes. |
description |
No |
String |
Specifies the image description. For details, 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. |
instance_id |
Yes |
String |
Specifies the ID of the ECS used to create the image. To obtain the ECS ID, perform the following operations:
|
data_images |
No |
Array of objects |
Specifies the data disk information to be converted. This parameter is mandatory when the data disk of an ECS is used to create a private data disk image. For details, see Table 1. If the ECS data disk is not used to create a data disk image, the parameter is empty by default. NOTE:
When you create a data disk image using a data disk, if other parameters (such as name, description, and tags) in this table have values, the system uses the value of data_images. You cannot specify instance_id. |
tags |
No |
Array of strings |
Specifies tags of the image. This parameter is left blank by default. Use either tags or image_tags. |
image_tags |
No |
Array of objects |
Specifies tags of the image. This parameter is left blank by default. Use either tags or image_tags. |
enterprise_project_id |
No |
String |
Specifies the enterprise project that the image belongs to.
|
max_ram |
No |
Integer |
Specifies the maximum memory of the image in the unit of MB. |
min_ram |
No |
Integer |
Specifies the minimum memory of the image in the unit of MB. The default value is 0, indicating that the memory is not restricted. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Specifies the name of a data disk image. |
volume_id |
Yes |
String |
Specifies the data disk ID. |
description |
No |
String |
Specifies the data disk description. |
tags |
No |
Array of strings |
Specifies the data disk image tag. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Specifies the image name. For detailed description, see Image Attributes. |
description |
No |
String |
Specifies the image description. 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 type. The value can be Linux, Windows, or Other. |
os_version |
No |
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. NOTE:
This parameter is mandatory when the value of is_quick_import is true, that is, a system disk image is imported using the quick import method. |
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. The value ranges from 1 GB to 1024 GB. |
is_config |
No |
Boolean |
Specifies whether automatic configuration is enabled. The value can be true or false. If automatic configuration is required, set the value to true. Otherwise, set the value to false The default value is false. For details about automatic configuration, see Creating a Linux System Disk Image from an External Image File > Registering an External Image File as a Private Image (Linux) in Image Management Service User Guide. |
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 |
Array of strings |
Specifies tags of the image. The value is left blank by default. Use either tags or image_tags. |
image_tags |
No |
Array of objects |
Specifies tags of the image. This parameter is left blank by default. Use either tags or image_tags. |
type |
No |
String |
Specifies the image type. The value can be ECS, BMS, FusionCompute, or Ironic. The default value is ECS.
|
enterprise_project_id |
No |
String |
Specifies the enterprise project that the image belongs to.
|
max_ram |
No |
Integer |
Specifies the maximum memory of the image in the unit of MB. |
min_ram |
No |
Integer |
Specifies the minimum memory required by the image in the unit of MB. The default value is 0, indicating that the memory is not restricted. |
data_images |
No |
Array of objects |
Specifies the data disk information to be imported. An external image file can contain a maximum of three data disks. In this case, one system disk and three data disks will be created. For details, see Table 2. NOTE:
|
is_quick_import |
No |
Boolean |
Specifies whether to use the quick import method to import a system disk image.
For details about the restrictions on quick import of image files, see Importing an Image File Quickly. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Specifies the image name. For more details, see Image Attributes. |
description |
No |
String |
Specifies the image description. The value is left blank by default. The value contains a maximum of 1024 characters and consists of only letters and digits. Carriage returns and angle brackets (< >) are not allowed. For more details, see Image Attributes. |
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.
NOTE:
The storage class of the OBS bucket must be Standard. |
min_disk |
Yes |
Integer |
Specifies the minimum size of the data disk. Unit: GB Value range: 1–2048 |
is_quick_import |
No |
Boolean |
Specifies whether an image file is imported quickly to create a data disk image.
For details about the restrictions on quick import of image files, see Importing an Image File Quickly. |
tags |
No |
Array of strings |
Specifies tags of the image. The value is left blank by default. For detailed parameter descriptions, see Image Tag Data Formats. Use either tags or image_tags. |
image_tags |
No |
Array of objects |
Specifies tags of the image. The value is left blank by default. For detailed parameter descriptions, see Image Tag Data Formats. Use either tags or image_tags. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Specifies the name of the system disk image. For more details, see Image Attributes. |
volume_id |
Yes |
String |
Specifies the data disk ID. |
os_version |
Yes |
String |
Specifies the OS version. Set the parameter value based on Values of Related Parameters. Otherwise, the created system disk image may be unavailable. During the creation of a system disk image, if the OS can be detected from the data disk, the OS version in the data disk is used. In this case, the os_version value is invalid. If the OS can be detected from the data disk, the os_version value is used. |
type |
No |
Sting |
Specifies the image type. The value can be ECS, BMS, FusionCompute, or Ironic.
The default value is ECS. |
description |
No |
String |
Specifies the image description. This parameter is left blank by default. For details, see Image Attributes. The image description must meet the following requirements:
|
min_ram |
No |
Integer |
Specifies the minimum memory size (MB) required for running the image. The parameter value depends on the ECS specifications. The default value is 0. |
max_ram |
No |
Integer |
Specifies the maximum memory size (MB) required for running the image. The parameter value depends on the ECS specifications. The default value is 0. |
tags |
No |
Array of strings |
Specifies tags of the image. This parameter is left blank by default. Use either tags or image_tags. |
image_tags |
No |
Array of objects |
Specifies tags of the image. This parameter is left blank by default. Use either tags or image_tags. |
enterprise_project_id |
No |
String |
Specifies the enterprise project that the image belongs to.
|
POST https://{Endpoint}/v2/cloudimages/action
{
"name": "ims_test",
"description": "Create a system disk image from an ECS",
"instance_id": "877a2cda-ba63-4e1e-b95f-e67e48b6129a",
"tags": [
"aaa.111",
"bbb.333",
"ccc.444"
]
}
POST https://{Endpoint}/v2/cloudimages/action
1 2 3 4 5 6 7 8 9 10 11 | { "data_images": [{"name": "ims_data_image_test", "description": "Create a data disk image from the data disk of an ECS", "volume_id": "c5dfbd0c-bf0a-4798-a453-61dc6b54aa30", "tags": [ "aaa.111", "bbb.333", "ccc.444" ] }] } |
POST https://{Endpoint}/v2/cloudimages/action
1 2 3 4 5 6 7 8 9 10 11 12 | { "name": "ims_test_file", "description": "Create an image from a file in the OBS bucket", "image_url": "ims-image:centos70.qcow2", "os_version": "CentOS 7.0 64bit", "min_disk": 40, "tags": [ "aaa.111", "bbb.333", "ccc.444" ] } |
POST https://{Endpoint}/v2/cloudimages/action
{
"name": "ims_test",
"description": "Create a system disk image from an ECS",
"instance_id": "877a2cda-ba63-4e1e-b95f-e67e48b6129a",
"image_tags": [
{
"key": "key2",
"value": "value2"
},
{
"key": "key1",
"value": "value1"
}
]
}
POST /v2/cloudimages/action
1 2 3 4 5 6 7 | { "data_images": [{"name": "ims_data_image_test", "description": "Create a data disk image from the data disk of an ECS", "volume_id": "c5dfbd0c-bf0a-4798-a453-61dc6b54aa30", "image_tags": [{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}] }] } |
POST https://{Endpoint}/v2/cloudimages/action
1 2 3 4 5 6 7 8 | { "name": "ims_test_file", "description": "Create an image from a file in the OBS bucket", "image_url": "ims-image:centos70.qcow2", "os_version": "CentOS 7.0 64bit", "min_disk": 40, "image_tags": [{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}] } |
POST https://{Endpoint}/v2/cloudimages/action
1 2 3 4 5 6 7 8 9 10 11 12 | { "name": "ims_test", "description": "Create a system disk image from a data disk", "volume_id": "877a2cda-ba63-4e1e-b95f-e67e48b6129a", "type": "ECS", "os_version": "CentOS 7.0 64bit", "tags": [ "aaa.111", "bbb.333", "ccc.444" ] } |
POST https://{Endpoint}/v2/cloudimages/action
1 2 3 4 5 6 7 8 | { "name": "ims_test", "description": "Create a system disk image from a data disk", "volume_id": "877a2cda-ba63-4e1e-b95f-e67e48b6129a", "type": "ECS", "os_version": "CentOS 7.0 64bit", "image_tags": [{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}] } |
Parameter |
Type |
Description |
---|---|---|
job_id |
String |
Specifies the asynchronous job ID. For details, see Asynchronous Job Query. |
STATUS CODE 200
1 2 3 | { "job_id": "8a12fc664fb4daa3014fb4e581380005" } |
Returned 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. |