• Image Management Service

ims
  1. Help Center
  2. Image Management Service
  3. API Reference
  4. Native OpenStack APIs
  5. Image (Native OpenStack APIs)
  6. Uploading an Image

Uploading an Image

Function

This API is used to upload a local image to the cloud platform. The image to be uploaded must be smaller than 128 GB. For more information, see "Creating a Windows Private Image Using an External Image File" and "Creating a Linux Private Image Using an External Image File" in the Image Management Service User Guide.

The following describes how to use this API:

  1. Prepare the image to be uploaded. The image can be in QCOW2, VMDK, VHD, RAW, VHDX, QED, VDI, QCOW, ZVHD2, or ZVHD format.
  2. Create metadata for the image by performing the operations in Creating Image Metadata. After the API is invoked successfully, save the image ID.
  3. Upload the image file with the image ID obtained in 2.

URI

  • URI format

    PUT /v2/images/{image_id}/file

  • 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. Image upload 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 is uploaded successfully.

Request

Example request
curl -i --insecure 'https://IP/v2/images/84ac7f2b-bf19-4efb-86a0-b5be8771b476/file' -X PUT -H "X-Auth-Token: $mytoken" -H "Content-Type:application/octet-stream" -T /mnt/userdisk/images/suse.zvhd

Response

HTTP/1.1 204

Returned Values

  • Normal

    204

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

409 Conflict

Request conflict.

500 System Error

System error.