• Image Management Service

ims
  1. Help Center
  2. Image Management Service
  3. API Reference
  4. APIs
  5. Image (Extension APIs)
  6. Creating a Full-ECS Image

Creating a Full-ECS Image

Function

This API is an asynchronous one and used to create a full-ECS image from an ECS or a Cloud Server Backup Service (CSBS) backup. 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.

URI

URI format

POST /v1/cloudimages/wholeimages/action

Constraints (Creating a Full-ECS Image Using an ECS)

  • Before creating a full-ECS image, you must optimize the ECS as prompted. Otherwise, creating ECSs from the full-ECS image may fail.
  • An ECS used to create a full-ECS image must be in the Running or Stopped state.
  • A Windows ECS used to create a full-ECS image cannot have a spanned volume. Otherwise, data may be lost when you create ECSs using the full-ECS image.
  • A Linux ECS used to create a full-ECS image cannot have a volume group or a logical volume consisting of multiple physical volumes. Otherwise, data may be lost when you create ECSs using the full-ECS image.
  • If a full-ECS image is available in an AZ, it can be used to create ECSs only in this AZ.
  • If a full-ECS image is available in a region, the full-ECS image can be used to create ECSs only in this region.
  • The system disk cannot be detached from the ECS used to create a full-ECS image.
  • A full-ECS image cannot be shared with other tenants.
  • A full-ECS image cannot be published as a Marketplace image.
  • A full-ECS image cannot be exported or replicated.
  • For a Windows ECS used to create a full-ECS image, you must set the SAN policy of the ECS to OnlineAll. Otherwise, the EVS disks attached to the ECS may be offline.

    Windows has three types of SAN policies: OnlineAll, OfflineShared, and OfflineInternal.

    Table 1 SAN policies

    Type

    Description

    OnlineAll

    Indicates that all newly detected disks are automatically brought online.

    OfflineShared

    Indicates that all disks on sharable buses, such as iSCSI and FC, are left offline by default, while disks on non-sharable buses are kept online.

    OfflineInternal

    Indicates that all newly detected disks are left offline as default.

    1. Run the following command on DiskPart to query the current SAN policy of the ECS:

      diskpart

    2. Run the following command to view the SAN policy of the ECS:
      san
      • If the SAN policy is OnlineAll, run the exit command to exit DiskPart.
      • If the SAN policy is not OnlineAll, go to 3.
    3. Run the following command to change the SAN policy to OnlineAll:

      san policy=onlineall

Constraints (Creating a Full-ECS Image Using a CSBS Backup)

  • Before creating a full-ECS image, you must optimize the CSBS backup as prompted. Otherwise, the full-ECS image may fail to create ECSs.
  • A CSBS backup used to create a full-ECS image cannot have a shared EVS disk.
  • A CSBS backup used to create a full-ECS image must be available. A CSBS backup can be used to create one full-ECS image.
  • A full-ECS image cannot be shared with other tenants.
  • A full-ECS image cannot be published as a Marketplace image.
  • A full-ECS image cannot be exported or replicated.

Request

  • Parameters in the request body when an ECS is used to create a full-ECS 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.

    tags

    No

    List<String>

    Lists the image tags.

    Use either tags or image_tags.

    image_tags

    No

    List<Map>

    Lists the image tags. This parameter is left blank by default.

    Use either tags or image_tags.

    instance_id

    Yes

    String

    Specifies the ECS ID. This parameter is required when you use an ECS to create a full-ECS image.

    max_ram

    No

    Int

    Specifies the maximum memory of the image in the unit of MB. This parameter is not configured by default.

    min_ram

    No

    Int

    Specifies the minimum memory of the image in the unit of MB. The default value is 0.

  • Parameters in the request body when a CSBS backup is used to create a full-ECS 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.

    tags

    No

    List<String>

    Lists the image tags.

    backup_id

    Yes

    String

    Specifies the CSBS backup ID. This parameter is required when you use a CSBS backup to create a full-ECS image.

    max_ram

    No

    Int

    Specifies the maximum memory of the image in the unit of MB. This parameter is not configured by default.

    min_ram

    No

    Int

    Specifies the minimum memory of the image in the unit of MB. The default value is 0, indicating that the memory is not restricted.

  • Example requests
    • Request for creating a full-ECS image from an ECS with parameter tags
      POST /v1/cloudimages/wholeimages/action
      {
             "name": "instance_whole_image",
             "description":"Create a full-ECS image using an ECS.",
             "instance_id": "877a2cda-ba63-4e1e-b95f-e67e48b6129a",
             "tags":[
                        "aaa.111",
                        "bbb.333",
                        "ccc.444"
                    ]
         } 
    • Request for creating a full-ECS image from a CSBS backup with parameter tags
      POST /v1/cloudimages/wholeimages/action
      {
           "name": "backup_whole_image",
           "description":"Create a full-ECS image using a CSBS backup.",
           "backup_id":"9b27efab-4a17-4c06-bfa2-3e0cf021d3c3",
           "tags":[
                       "aaa.111",
                       "bbb.333",
                       "ccc.444"
                   ]
              }
    • Request for creating a full-ECS image from an ECS with parameter image_tags
      POST /v1/cloudimages/wholeimages/action
      {
             "name": "instance_whole_image",
             "description":"Create a full-ECS image using an ECS.",
             "instance_id": "877a2cda-ba63-4e1e-b95f-e67e48b6129a",
             "image_tags":[{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}]
      } 
    • Request for creating a full-ECS image from a CSBS backup with parameter image_tags
      POST /v1/cloudimages/wholeimages/action
      {
           "name": "backup_whole_image",
           "description":"Create a full-ECS image using a CSBS backup.",
           "backup_id":"9b27efab-4a17-4c06-bfa2-3e0cf021d3c3",
           "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": "4010a32b5f909853015f90aaa24b0015"
    }

Returned Values

  • Normal

    200

  • Abnormal

    Returned 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.