Creating an Image Using an ECS
Function
This API is used to create an image using an ECS. After the creation, you can use this image to create ECSs.
Images created using an ECS are stored on storage nodes as snapshots.
This API is a native OpenStack API that is not applicable to the images on the cloud platform.
- To create a system disk image or data disk image, use the IMS API (POST /v2/cloudimages/action). For details, see "Creating an Image" in Image Management Service API Reference.
- To create a full-ECS image, use the IMS API (POST /v1/cloudimages/wholeimages/action). For details, see "Creating a Full-ECS Image" in Image Management Service API Reference.
Constraints
- An ECS in the error state cannot be used to create an image.
- If an image created using an ECS is used to create a new ECS, the new ECS must be located in the same AZ as the original ECS.
- After an image created using an ECS is deleted, the associated snapshots will not be automatically deleted (this function is implemented by native OpenStack). You must manually delete such snapshots.
- The image created using an ECS cannot be used to create data disks.
- The images created using the API described in this section (URI: POST /v2/{project_id}/servers/{server_id}/action or POST /v2.1/{project_id}/servers/{server_id}/action) cannot be exported to OBS buckets. If such images must be exported, use the IMS API (POST /v2/cloudimages/action). For details, see "Creating an Image" in Image Management Service API Reference.
Huawei Cloud no longer provides Windows images. This API cannot be used to create images using Windows ECSs.
URI
POST /v2.1/{project_id}/servers/{server_id}/action
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Specifies the project ID. For details about how to obtain the ID, see Obtaining a Project ID. |
server_id |
Yes |
Specifies the ECS ID. |
Request
Table 2 describes the request parameters.
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
createImage |
Yes |
Object |
Specifies the image created using ECS. For details, see Table 3. |
Response
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Location |
Yes |
String |
Specifies the local URL of the image, which is returned in the request header. This parameter is not supported in microversion 2.44 and later. |
image_id |
Yes |
String |
Specifies the image UUID. This parameter is supported in microversion 2.45 and later. |
Example Request
Use a specified ECS to create a private image named new-image-name.
POST https://{endpoint}/v2.1/{project_id}/servers/{server_id}/action { "createImage" : { "name" : "new-image-name", "metadata": { "ImageType": "Gold", "ImageVersion": "2.0" } } }
Example Response
None
Returned Values
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