Uploading image data
PUT /v2/images/{image_id}/file
Upload a binary image file to an image record created, according to Creating image records.
Before you can store binary image data, you must meet the following preconditions:
- The image must exist.
- You must set the disk and container formats in the image.
- The image status must be
queued
. - Your image storage quota must be sufficient.
- The size of the data that you want to store must not exceed the size that the OpenStack Image service allows.
After the operation completes, the image status will change to active
.
Request
Parameters
Name | In | Type | Description |
---|---|---|---|
Content-Type
|
header | string | The media type descriptor for the request body. Use
application/openstack-images-v2.1-json-patch . (You can also use
application/openstack-images-v2.0-json-patch , but keep in mind that
it’s deprecated.) |
X-Image-Meta-Store (Optional) |
header | string |
A store identifier to upload or import image data. Should only be included when making a request to a cloud that supports multiple backing stores. Use the store discovery call to determine an appropriate store identifier. Simply omit this header to use the default store. New in version 2.8 |
image_id
|
path | string | The UUID of the image. |
Example
Set the Content-Type
request header to application/octet-stream
.
# curl -ks -X PUT -H 'Content-Type: application/octet-stream' -H 'X-Auth-Token: gAAAAA<...>' \ --data-binary @cirros2.qcow2 \ https://<node_IP_addr>:9292/v2/images/8988013f-9079-4f7d-855f-d2cb67e9d71c/file
Response
Status codes
Success
Code | Reason |
---|---|
204 - No Content
|
The server has fulfilled the request. |
Error
Code | Reason |
---|---|
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 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 request 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. This is mostly caused by service configuration errors which prevents the service from successful start up. |