Updated on 2024-07-12 GMT+08:00

Exporting an Image

Function

This is an extension API and used to export a private image to an OBS bucket.

Before exporting an image, ensure that you have the Tenant Administrator permission for OBS.

Constraints

  • An image can only be exported to a Standard bucket that is in the same region as the image.
  • The following private images cannot be exported:
    • Full-ECS images
    • ISO images
    • Private images created from an Ubuntu public image
  • The image size must be less than 1 TB. Images larger than 128 GB support only fast export.

URI

POST /v1/cloudimages/{image_id}/file

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

Parameter

Mandatory

Type

Description

image_id

Yes

String

Specifies the image ID.

For details about how to obtain the image ID, see Querying Images.

Request

  • Request parameters

    Parameter

    Mandatory

    Type

    Description

    bucket_url

    Yes

    String

    Specifies the URL of the image file in the format of Bucket name:File name.

    NOTE:

    The storage class of the OBS bucket must be Standard.

    file_format

    Yes

    String

    Specifies the file format. The value can be qcow2, vhd, zvhd, or vmdk.

    is_quick_export

    No

    Boolean

    Whether to enable fast export. The value can be true or false.

    NOTE:

    If fast export is enabled, file_format cannot be specified. The exported image file is in the ZVHD2 format.

Example Request

Exporting an image to a QCOW2 file (file address in the target OBS bucket: ims-image:centos7_5.qcow2)

1
2
3
4
5
6
POST https://{Endpoint}/v1/cloudimages/d164b5df-1bc3-4c3f-893e-3e471fd16e64/file
{
   "bucket_url": "ims-image:centos7_5.qcow2",
   "file_format": "qcow2",
   "is_quick_export": false
}

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": "edc89b490d7d4392898e19b2deb34797"
    }
    

Returned Values

  • Normal

    200

  • Abnormal

    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.