Registering an 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:
- Upload the image file to an OBS bucket. For details, see Uploading a File or Folder.
- 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 (Native OpenStack API).
- Use the API for registering images and the image ID obtained in 2 to register the image file as a private image.
- After this asynchronous API is successfully called, the background 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.
For details about how to query an asynchronous job, see Querying the Progress of an Asynchronous Job.
Before registering an image file, ensure that you have Tenant Administrator permissions for OBS.
Debugging
You can debug this API in API Explorer.
Authorization
Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned. For details about the required permissions, see Permissions and Supported Actions.
URI
PUT /v1/cloudimages/{image_id}/upload
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| image_id | Yes | String | Specifies the image ID.
|
Request
- Request parameters
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, ISO, or VMDK format.
NOTE:The storage class of the OBS bucket must be Standard.
Example Request
Registering an image (URL of the image file: bucketname:Centos6.5-disk1.vmdk)
1 2 3 4 | PUT https://{Endpoint}/v1/cloudimages/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86/upload { "image_url": "bucketname:Centos6.5-disk1.vmdk" } |
Response
- Response parameters
Parameter
Type
Description
job_id
String
Specifies the asynchronous job ID.
For details, see Querying the Progress of an Asynchronous Job.
- Example response
HTTP/1.1 200
1 2 3
{ "job_id":" b912fb4a4c464b568ecfca1071b21b10" }
Returned Values
| Returned Value | Description |
|---|---|
| 400 Bad Request | Request error. For details about the returned error code, see Error Codes. |
| 401 Unauthorized | Authentication failed. |
| 403 Forbidden | Insufficient permissions. |
| 404 Not Found | Requested resource not found. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot