Creating Image Metadata (Native OpenStack API)
Function
This API is used to create image metadata.
After the API is successfully invoked, the image metadata is created, but the image file does not exist yet.
URI
POST /v2/images
Request
- Request parameters
Parameter
Mandatory
Type
Description
__os_version
No
String
Specifies the image OS version. For the value range, see Values of Related Parameters.
If this parameter is not specified, the value Other Linux(64 bit) will be used. In that case, the ECS creation using this image may fail, and the ECS created using this image may fail to run properly.
visibility
No
String
Specifies whether the image is available to other tenants.
The default value is private. When creating image metadata, the value of visibility can be set to private only.
name
No
String
Specifies the image name. If this parameter is not specified, its value is empty by default. In that case, ECS creation using this image will fail. The name contains 1 to 255 characters. For detailed description, see Image Attributes. This parameter is left blank by default.
protected
No
Boolean
Specifies whether the image is protected. A protected image cannot be deleted. The default value is false.
container_format
No
String
Specifies the container format.
The default value is bare.
disk_format
No
String
Specifies the image format. The value can be zvhd2, vhd, raw, iso, or qcow2. The default value is zvhd2 for a non-ISO image.
tags
No
Array of strings
Lists the image tags. The tag contains 1 to 255 characters. The value is left blank by default.
NOTE:The tag is a key-value pair. Example:
"tagkey=tagvalue"
min_ram
No
Integer
Specifies the minimum memory size (MB) required for running the image. The parameter value depends on ECS specifications. The default value is 0.
min_disk
No
Integer
Specifies the minimum disk space (GB) required for running the image. The value ranges from 40 GB to 255 GB.
The value of this parameter must be greater than the image system disk capacity. Otherwise, the ECS creation may fail.
Example Request
POST https://{Endpoint}/v2/images { "__os_version": "Ubuntu 14.04 server 64bit", "container_format": "bare", "disk_format": "vhd", "min_disk": 100, "min_ram": 1024, "name": "test", "tags": [ "test=testvalue", "image=imagevalue" ], "visibility": "private", "protected": false }
Response
- Response parameters
Parameter
Type
Description
visibility
String
Specifies whether the image is available to other tenants. The value is private.
name
String
Specifies the image name. If this parameter is not specified, its value is empty by default. In that case, ECS creation using this image will fail. The name contains 1 to 128 characters. For detailed description, see Image Attributes.
protected
Boolean
Specifies whether the image is protected. A protected image cannot be deleted. The value is false.
container_format
String
Specifies the container format.
The value is bare.
disk_format
String
Specifies the image format. The value can be zvhd2, vhd, raw, iso, or qcow2. The default value is zvhd2 for a non-ISO image.
tags
Array of strings
Lists the image tags. The tag contains 1 to 255 characters.
min_ram
Integer
Specifies the minimum memory size (MB) required for running the image. The parameter value depends on the ECS specifications limit. The value is generally set to 0.
min_disk
Integer
Specifies the minimum disk space (GB) required for running the image. It must be greater than the system disk capacity in the image. Otherwise, the ECS creation will fail. The value ranges from 40 GB to 255 GB.
status
String
Specifies the image status. The value can be one of the following:
- queued: indicates that the image metadata has already been created, and it is ready for the image file to upload.
- saving: indicates that the image file is being uploaded to the backend storage.
- deleted: indicates that the image has been deleted.
- killed: indicates that an error occurs on the image uploading.
- active: indicates that the image is available for use.
created_at
String
Specifies the time when the image was created. The value is in UTC format.
updated_at
String
Specifies the time when the image was updated. The value is in UTC format.
self
String
Specifies the image URL.
id
String
Specifies the image ID. After the image creation API is called, the image ID must be saved. The image ID is used to invoke the image uploading API and upload the image.
file
String
Specifies the URL for uploading and downloading the image file.
schema
String
Specifies the URL for accessing the schema.
__image_source_type
String
Specifies the image backend storage type. Only UDS is supported currently.
__image_size
String
Specifies the image size. The unit is byte.
__isregistered
String
Specifies whether the image is registered. Only registered images can be queried on the portal. The value is true.
__os_version
String
Specifies the image OS version. For the value range, see Values of Related Parameters.
__os_type
String
Specifies the image OS type. The value of this parameter depends on that of __os_version. The value can be Windows, Linux, or other.
__platform
String
Specifies the OS platform supported by the image. The value of this parameter depends on that of __os_version.
__os_bit
String
Specifies the OS bit. The value of this parameter depends on that of __os_version. The value can be 32 or 64.
__imagetype
String
Specifies the image type. private indicates a private image.
virtual_env_type
String
Specifies the platform type.
Specifies the environment where the image is used. The value can be FusionCompute, Ironic, DataImage, or IsoImage.
- For an ECS image, the value is FusionCompute.
- For an ECS data disk image, the value is DataImage.
- For a BMS image, the value is Ironic.
- For an ISO image, the value is IsoImage.
owner
String
Specifies the ID of the project to which the image belongs.
__root_origin
String
Specifies that the image is created from an external image file. Value: file
checksum
String
Specifies the MD5 value of the image file.
size
Long
This parameter is unavailable currently.
virtual_size
Integer
Specifies the virtual size of the image. The unit is byte.
properties
Properties object
Specifies a collection of image attributes instead of a specified attribute.
- Example response
STATUS CODE 201
{ "schema": "/v2/schemas/image", "min_disk": 100, "created_at": "2016-06-02T07:49:48Z", "__image_source_type": "uds", "container_format": "bare", "__image_size": "0", "file": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86/file", "updated_at": "2016-06-02T07:49:49Z", "protected": false, "id": "4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86", "__isregistered": "true", "min_ram": 1024, "owner": "b912fb4a4c464b568ecfca1071b21b10", "__os_type": "Linux", "__imagetype": "private", "visibility": "private", "virtual_env_type": "FusionCompute", "tags": [ "test=testvalue", "image=imagevalue" ], "__platform": "Ubuntu", "__os_bit": "64", "__os_version": "Ubuntu 14.04 server 64bit", "name": "test", "self": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86", "disk_format": "vhd", "status": "queued" }
Returned Values
- Normal
- Abnormal
Returned Value
Description
400 Bad Request
Request error.
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.
500 Internal Server Error
Internal service error.
503 Service Unavailable
The service is unavailable.
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