Uploading image data
PUT /v2/images/{image_id}/file
Upload a binary image file to an image record created with POST /v2/images.
Before you can store binary image data, the request must meet the following preconditions:
- The image must exist.
- You must set the
disk_formatandcontainer_formatin the image record. - The image
statusmust bequeued. - Your image storage quota must be sufficient.
- The size of the data you upload must not exceed the limit configured for the OpenStack Image service.
Source: OpenStack Image service API v2 — Upload binary image data
Request
Headers
Content-Type(header, string) — Media type descriptor for the request body. When uploading raw binary image data set this toapplication/octet-stream(or an appropriate image media type supported by your cloud).X-Image-Meta-Store(Optional, header, string) — A store identifier to upload or import image data. Include this only for clouds that support multiple backing stores. Omit to use the default store. (New in API v2.8)X-Auth-Token— Your Keystone auth token.
Path parameters
| Name | In | Type | Description |
|---|---|---|---|
image_id | path | string | The UUID of the image to which you're uploading data. |
Example (curl)
Set the Content-Type request header to application/octet-stream and send the image as binary data.
curl -ks -X PUT \
-H 'Content-Type: application/octet-stream' \
-H 'X-Auth-Token: gAAAAA<...>' \
--data-binary @alpine.qcow2 \
https://api.vietnix.cloud:9292/v2/images/9775d86a-8bf8-4200-a4b5-d892e931e8f6/file
Response
Success
| Status Code | Description |
|---|---|
| 204 - No Content | The server accepted the data and completed the upload. After a successful upload the image status will change to active. |
Error
| Status Code | Description |
|---|---|
| 400 - Bad Request | Some content in the request was invalid. |
| 401 - Unauthorized | User must authenticate before making a request. |
| 403 - Forbidden | Policy does not allow current user to do this operation. |
| 404 - Not Found | The requested image resource could not be found. |
| 409 - Conflict | This operation conflicted with another operation on this resource. |
| 410 - Gone | The access request to the target resource is no longer available. |
| 413 - Request Entity Too Large | The upload is larger than the server is willing or able to process. |
| 415 - Unsupported Media Type | The request entity has a media type which the server or resource does not support. |
| 503 - Service Unavailable | Service is not available (operator/service configuration issue). |