Updated on 2024-04-16 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 a Windows, SUSE, Red Hat, Ubuntu, or Oracle Linux public image
  • The image size must be less than 128 GB.

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.

Example Request

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

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.