Reviewed-by: Pristromskaia, Margarita <margarita.pristromskaia@t-systems.com> Co-authored-by: wanghuijuan738 <wanghuijuan738@huawei.com> Co-committed-by: wanghuijuan738 <wanghuijuan738@huawei.com>
12 KiB
Uploading an Image (Native OpenStack API)
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 about how to use external files to create images, see sections "Creating a Private Windows Image Using an External Image File" and "Creating a Private Linux Image Using an External Image File" in Image Management Service User Guide.
The following describes how to use this API:
- Prepare the image to be uploaded. The image can be in QCOW2, VMDK, VHD, RAW, VHDX, QED, VDI, QCOW, ZVHD2, or ZVHD format.
- Create metadata for the image by performing the operations in Creating Image Metadata (Native OpenStack API). After the API is invoked successfully, save the image ID.
- Upload the image file with the image ID obtained in 2.
URI
PUT /v2/images/{image_id}/file
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
image_id |
Yes |
String |
Specifies the image ID.
|
- AK/SK authentication supports API requests with a body not larger than 12 MB. For API requests with a larger body, token authentication is recommended.
- API Gateway checks the time format and compares the request time with the time when API Gateway received the request. If the time difference exceeds 15 minutes, API Gateway will reject the request. So, the local time on the client must be synchronized with the clock server to avoid a large offset in the value of X-Sdk-Date in the request header.
Request
- Request parameters
Parameter
Mandatory
Type
Description
image_file
Yes
file
Specifies the local file to be uploaded.
Example Request
PUT https://{Endpoint}/v2/images/84ac7f2b-bf19-4efb-86a0-b5be8771b476/file
Returned Values
- Normal
- 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.