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 "Object Storage Service User Guide".
- 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 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.
For details about how to query the status of an asynchronous task, see Querying the Status of an Asynchronous Job.
Before registering an image file, ensure that you have the Tenant Administrator permission for OBS.
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 Status 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 |
You do not have the rights to perform the operation. |
404 Not Found |
The requested resource was 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