• Image Management Service

ims
  1. Help Center
  2. Image Management Service
  3. API Reference
  4. Native OpenStack APIs
  5. Image (Native OpenStack APIs)
  6. Creating Image Metadata

Creating Image Metadata

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

URI format

POST /v2/images

Request

  • Parameter description

    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 will be set to Other Linux(64 bit). In that case, the ECS creation using this image may fail, and ECSs created using this image may fail to run properly.

    visibility

    No

    String

    Specifies whether the image is visible 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 file format. The value can be vhd, zvhd, raw, zvhd2, or qcow2. The default value is vhd.

    tags

    No

    List<String>

    Lists the image tags. The tag contains 1 to 255 characters. This parameter is left blank by default.

    min_ram

    No

    Int

    Specifies the minimum memory size (MB) required for running the image. The parameter value depends on the ECS specifications limit. The default value is 0.

    min_disk

    No

    Int

    Specifies the minimum disk space (GB) required for running the image. The value ranges from 1 GB to 1024 GB.

    The value of this parameter must be greater than the image system disk capacity. Otherwise, the ECS creation may fail.

    id

    No

    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. If this parameter is not included in the request, an ID will be created and returned for uploading images. The image ID cannot be specified.

    NOTE:

    Parameters in the request body are strings of no more than 255 characters, and their values can be left blank.

  • Example request
    POST /v2/images
    {
        "__os_version": "Ubuntu 14.04 server 64bit",
        "container_format": "bare",
        "disk_format": "vhd",
        "min_disk": 1,
        "min_ram": 1024,
        "name": "test",
        "tags": [
            "test",
            "image"
        ],
        "visibility": "private",
        "protected": false,
        "aaaa":"11111"
    }

Response

  • Parameter description

    Parameter

    Type

    Description

    visibility

    String

    Specifies whether the image is visible 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 file format. The value can be vhd, zvhd, raw, or qcow2. The default value is vhd.

    tags

    List<String>

    Lists the image tags. The tag contains 1 to 255 characters.

    min_ram

    Int

    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

    Int

    Specifies the minimum disk space (GB) required for running the image. The value ranges from 1 GB to 1024 GB. It must be greater than the image system disk capacity. Otherwise, the ECS creation may fail.

    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

    Timestamp

    Specifies the time when the image was created. The value is in UTC format.

    updated_at

    Timestamp

    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.

    __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, or DataImage.

    • For an ECS image, set the value to FusionCompute.
    • For a data disk image, set the value to DataImage.
    • For a BMS image, set the value to Ironic.

    owner

    String

    Specifies the ID of the project to which the image belongs.

    virtual_size

    Int

    Specifies the virtual size of the image.

    properties

    Dict

    Specifies a collection of image attributes instead of a specified attribute.

  • Example response
    STATUS CODE 201
    {
        "schema": "/v2/schemas/image",
        "min_disk": 1,
        "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",
            "image"
        ],
        "__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

    201

  • 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.