• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. Image Management
  6. Creating an Image Using an ECS

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 ECSs are stored on storage nodes as snapshots.

Notes

This API is a native OpenStack API that is not applicable to the images on the public 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.

Constraints

  1. ECSs in error state cannot be used to create images.
  2. 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.
  3. After an ECS is deleted, the images and snapshots created using this ECS will not be automatically deleted. You must manually delete them.
  4. 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.
  5. The image created using an ECS cannot be used to create data disks.
  6. 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.

URI

POST /v2.1/{project_id}/servers/{server_id}/action

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

server_id

Yes

Specifies the ECS ID.

Request

Request parameters

Table 2 describes the request parameters.

Table 2 Request parameter

Parameter

Type

Mandatory

Description

createImage

Dict

Yes

Creates an image using an ECS.

Table 3 createImage field description

Parameter

Type

Mandatory

Description

name

String

Yes

Specifies the image name with a length greater than 0 bytes and less than 243 bytes.

metadata

Dict

No

Specifies the image attribute with a length greater than 0 bytes and less than 255 bytes.

Response

Parameter

Type

Mandatory

Description

Location

String

Yes

Specifies the local URL of the image, which is returned in the request header.

This field is not supported in microversions later than 2.44.

image_id

String

Yes

Specifies the image UUID.

This field is supported in microversion 2.45.

Examples

  • Example request
    POST /v2/9c53a566cb3443ab910cf0daebca90c4/servers/47e9be4e-a7b9-471f-92d9-ffc83814e07a/action
    POST /v2.1/9c53a566cb3443ab910cf0daebca90c4/servers/47e9be4e-a7b9-471f-92d9-ffc83814e07a/action
    {
       "createImage" : {
            "name" : "new-image-name",
            "metadata": {
                "ImageType": "Gold",
                "ImageVersion": "2.0"
            }
        }
    }
  • Example response
    {
        "image_id": "ee10f19c-503c-44af-af2f-73d5e42f7a17"
    }

Returned Values

See General Request Returned Values.