• Image Management Service

ims
  1. Help Center
  2. Image Management Service
  3. API Reference
  4. APIs
  5. Image (Extension APIs)
  6. Registering an Image File as a Private Image

Registering an Image File as a Private Image

Function

This API is used to register an image file as an uninitialized private image on the cloud platform.

The following describes how to use this API:

  1. Upload the image file to an OBS bucket. For details, see the Object Storage Service User Guide.
  2. Use the image metadata creation API to create image metadata. After the API is invoked successfully, save the image ID. For how to create image metadata, see Creating Image Metadata.
  3. Use the API for registering images and the image ID obtained in 2 to register the image file as a private image.
  4. After the API is successfully invoked as an asynchronous one, the cloud service system receives a request. Query the image status using the image ID and check whether the image file is successfully registered. When the image status changes to active, the image file is successfully registered as a private image.
NOTE:

Before registering an image file, ensure that you have the Tenant Administrator permission of OBS.

URI

  • URI format

    PUT /v1/cloudimages/{image_id}/upload

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    image_id

    Yes

    String

    Specifies the image ID.

    • image_id is the ID of the image you created by invoking the API for creating image metadata. Registration may fail if you use other image IDs.
    • After this API is invoked, you can check the image status with the image ID. When the image status changes to active, the image file is successfully registered.

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    image_url

    Yes

    String

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

    Image files in the bucket can be in ZVHD, QCOW2, VHD, RAW, VHDX, QED, VDI, QCOW, ZVHD2 or VMDK format.

    NOTICE:

    The storage class of the OBS bucket must be Standard.

  • Example request
    PUT /v1/cloudimages/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86/upload
    {
       "image_url": "bucketname:Centos6.5-disk1.vmdk" 
    }

Response

HTTP/1.1 200
{
   "job_id":" b912fb4a4c464b568ecfca1071b21b10"
}

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.