Updated on 2024-02-23 GMT+08:00

Querying Images

Function

This API is used to query images using search criteria and to display the images in a list.

Windows images can no longer be queried.

URI

GET /v2/cloudimages{?__isregistered,__imagetype,__whole_image,__system__cmkid,protected,visibility,owner,id,status,name,flavor_id,container_format,disk_format,min_ram,min_disk,__os_bit,__platform,marker,limit,sort_key,sort_dir,__os_type,tag,member_status,__support_kvm,__support_xen,__support_largememory,__support_diskintensive,__support_highperformance,__support_xen_gpu_type,__support_kvm_gpu_type,__support_xen_hana,__support_kvm_infiniband,virtual_env_type,enterprise_project_id,created_at,updated_at,architecture}

You can type a question mark (?) and an ampersand (&) at the end of the URI to define multiple search criteria. For details, see the example request.

Table 1 Parameter description

Parameter

Mandatory

Type

Description

__isregistered

No

String

Specifies whether the image is available. The value can be true. The value is true for all extension APIs by default. Common users can query only the images for which the value of this parameter is true.

__imagetype

No

String

Specifies the image type. The following types are supported:

  • Public image: The value is gold.
  • Private image: The value is private.
  • Shared image: The value is shared.
  • Marketplace image: The value is market.
NOTE:

The __imagetype of images you share with other tenants or those other tenants share with you and you have accepted is shared. You can use field owner to distinguish the two types of shared images. You can use member_status to filter out shared images you have accepted.

__whole_image

No

Boolean

Specifies whether the image is a full-ECS image. The value can be true or false.

__system__cmkid

No

String

Specifies the ID of the key used to encrypt the image. You can obtain the ID from the IMS console or by calling the Querying Image Details (Native OpenStack API) API.

protected

No

Boolean

Specifies whether the image is protected. The value can be true or false. Set it to true when you query public images. This parameter is optional when you query private images.

visibility

No

String

Specifies whether the image is available to other tenants. Available values include:

  • public: public image
  • private: private image
  • shared: shared image

owner

No

String

Specifies the tenant to which the image belongs.

id

No

String

Specifies the image ID.

status

No

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.

name

No

String

Specifies the image name. Exact matching is used. For detailed description, see Image Attributes.

flavor_id

No

String

Specifies the ECS flavor ID used to filter out available public images.

Note:

  • You can specify only one flavor ID.
  • You can specify only an ECS flavor ID and cannot specify a BMS flavor ID.

    To filter out public images supported by a BMS flavor, use the __support_s4l=true filter criterion. s4l indicates board_type of the BMS flavor physical.s4.large. Refer to Common Query Methods for an example call.

container_format

No

String

Specifies the container type. The value is bare.

disk_format

No

String

Specifies the image format. The value can be zvhd2, vhd, zvhd, raw, iso, or qcow2. The default value is zvhd2 for a non-ISO image.

min_ram

No

Integer

Specifies the minimum memory size (MB) required for running the image. The parameter value depends on the ECS specifications. Generally, the 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.

__os_bit

No

String

Specifies the OS architecture, 32 bit or 64 bit.

__platform

No

String

Specifies the image platform type. The value can be Windows, Ubuntu, Red Hat, SUSE, CentOS, Debian, OpenSUSE, Oracle Linux, Fedora, CoreOS, EulerOS, Huawei Cloud EulerOS, or Other.

marker

No

String

Specifies the start number from which images are queried. The value is the image ID.

limit

No

Integer

Specifies the number of images that will be returned. The value is an integer and is 500 by default.

sort_key

No

String

Specifies the field for sorting the query results. The value can be an attribute of the image: name, container_format, disk_format, status, id, size, or created_at. The default value is created_at.

sort_dir

No

String

Specifies whether the query results are sorted in ascending or descending order. Its value can be desc (default) or asc. This parameter is used together with parameter sort_key. The default value is desc.

__os_type

No

String

Specifies the image OS type. Available values include:

  • Linux
  • Windows
  • Other

tag

No

String

Specifies a tag added to an image. Tags can be used as a filter to query images.

NOTE:

The tagging function has been upgraded. If the tags added before the function upgrade are in the format of "Key.Value", query tags using "Key=Value". For example, an existing tag is a.b. After the tag function upgrade, query the tag using "tag=a=b".

member_status

No

String

Specifies the member status. The value can be accepted, rejected, or pending. accepted: indicates that the shared image is accepted. rejected indicates that the image shared by others is rejected. pending indicates that the image shared by others needs to be confirmed. To use this parameter, set visibility to shared during the query.

__support_kvm

No

String

Specifies whether the image supports KVM. If yes, the value is true. Otherwise, this parameter is not required.

__support_xen

No

String

Specifies whether the image supports Xen. If yes, the value is true. Otherwise, this parameter is not required.

__support_largememory

No

String

Specifies whether the image supports large-memory ECSs. If the image supports large-memory ECSs, the value is true. Otherwise, this parameter is not required.

For the supported OSs, see OSs Supported by Different Types of ECSs.

__support_diskintensive

No

String

Specifies whether the image supports disk-intensive ECSs. If the image supports disk-intensive ECSs, the value is true. Otherwise, this parameter is not required.

__support_highperformance

No

String

Specifies whether the image supports high-performance ECSs. If the image supports high-performance ECSs, the value is true. Otherwise, this parameter is not required.

__support_xen_gpu_type

No

String

Specifies whether the image supports GPU-accelerated ECSs on the Xen platform. See Table 2 for its value. If the image does not support GPU-accelerated ECSs on the Xen platform, this parameter is not required. This attribute cannot co-exist with __support_xen and __support_kvm.

__support_kvm_gpu_type

No

String

Specifies whether the image supports GPU-accelerated ECSs on the KVM platform. See Table 3 for its value. If the image does not support GPU-accelerated ECSs on the KVM platform, this parameter is not required. This attribute cannot co-exist with __support_xen and __support_kvm.

__support_xen_hana

No

String

Specifies whether the image supports HANA ECSs on the Xen platform. If yes, the value is true. Otherwise, this parameter is not required.

This attribute cannot co-exist with __support_xen and __support_kvm.

__support_kvm_infiniband

No

String

Specifies whether the image supports ECSs with InfiniBand NICs on the KVM platform. If yes, the value is true. Otherwise, this parameter is not required.

This attribute cannot co-exist with __support_xen.

virtual_env_type

No

String

Specifies the environment where the image is used. The value can be FusionCompute, Ironic, DataImage, or IsoImage.

  • For an ECS image (system disk image), the value is FusionCompute.
  • For a data disk image, the value is DataImage.
  • For a BMS image, the value is Ironic.
  • For an ISO image, the value is IsoImage.

enterprise_project_id

No

String

Specifies the enterprise project to which the images to be queried belong.
  • If the value is 0, images of enterprise project default are to be queried.
  • If the value is UUID, images of the enterprise project corresponding to the UUID are to be queried.
  • If the value is all_granted_eps, images of all enterprise projects are to be queried.

    For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Center.

created_at

No

String

Specifies the time when the image was created. Images can be queried by time. The value is in the format of Operator:UTC time.

The following operators are supported:

  • gt: greater than
  • gte: greater than or equal to
  • lt: less than
  • lte: less than or equal to
  • eq: equal to
  • neq: not equal to

The time format is yyyy-MM-ddThh:mm:ssZ or yyyy-MM-dd hh:mm:ss.

For example, to query images created before Oct 28, 2018 10:00:00, set the value of created_at as follows:

created_at=lt:2018-10-28T10:00:00Z

updated_at

No

String

Specifies the time when the image was modified. Images can be queried by time. The value is in the format of Operator:UTC time.

The following operators are supported:

  • gt: greater than
  • gte: greater than or equal to
  • lt: less than
  • lte: less than or equal to
  • eq: equal to
  • neq: not equal to

The time format is yyyy-MM-ddThh:mm:ssZ or yyyy-MM-dd hh:mm:ss.

For example, to query images updated before Oct 28, 2018 10:00:00, set the value of updated_at as follows:

updated_at=lt:2018-10-28T10:00:00Z

architecture

No

String

Specifies the image architecture type. The value can be:

  • x86
  • arm

Request

Request parameters

None

Example Request

Querying public images (the results will be sorted by image name and only one image will be returned)

GET https://{Endpoint}/v2/cloudimages?__imagetype=gold&sort_key=name&limit=1

Common Query Methods

  • Public images

    GET /v2/cloudimages?__imagetype=gold&visibility=public&protected=true

  • Private images

    GET /v2/cloudimages?owner={project_id}

  • Available shared images

    GET /v2/cloudimages?member_status=accepted&visibility=shared&__imagetype=shared

  • Rejected images

    GET /v2/cloudimages?member_status=rejected&visibility=shared&__imagetype=shared

  • Unaccepted images

    GET /v2/cloudimages?member_status=pending&visibility=shared&__imagetype=shared

  • Public images supported by a BMS flavor

    GET /v2/cloudimages?__imagetype=gold&__support_xxx=true&virtual_env_type=Ironic

Response

  • Response parameters

    Parameter

    Type

    Description

    images

    Array of objects

    Specifies image details.

    For details, see Table 2.

    Table 2 Data structure description of the images field

    Parameter

    Type

    Description

    file

    String

    Specifies the URL for uploading and downloading the image file.

    owner

    String

    Specifies the tenant to which the image belongs.

    id

    String

    Specifies the image ID.

    size

    Long

    This parameter is unavailable currently.

    self

    String

    Specifies the image URL.

    schema

    String

    Specifies the image schema.

    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.

    tags

    Array of strings

    Specifies tags of the image, through which you can manage private images in your own way. You can use the image tag API to add different tags to each image and filter images by tag.

    visibility

    String

    Specifies whether the image is available to other tenants. Available values include:

    • private: private image
    • public: public image
    • shared: shared image

    name

    String

    Specifies the image name. For detailed description, see Image Attributes.

    checksum

    String

    This parameter is unavailable currently.

    protected

    Boolean

    Specifies whether the image is protected. A protected image cannot be deleted. The value can be true or false.

    container_format

    String

    Specifies the container type.

    min_ram

    Integer

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

    max_ram

    String

    Specifies the maximum memory (MB) of the image. You can set this parameter based on the ECS specifications. Generally, you do not need to set this parameter.

    updated_at

    String

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

    __os_bit

    String

    Specifies the OS architecture, 32 bit or 64 bit.

    __os_version

    String

    Specifies the OS version.

    __description

    String

    Provides supplementary information about the image. For detailed description, see Image Attributes.

    disk_format

    String

    Specifies the image format. The value can be zvhd2, vhd, zvhd, raw, iso, or qcow2. The default value is zvhd2 for a non-ISO image.

    __isregistered

    String

    Specifies whether the image has been registered. The value can be true or false.

    __platform

    String

    Specifies the image platform type. The value can be Windows, Ubuntu, Red Hat, SUSE, CentOS, Debian, OpenSUSE, Oracle Linux, Fedora, Other, CoreOS, or EulerOS.

    __os_type

    String

    Specifies the OS type. The value can be Linux, Windows, or Other.

    min_disk

    Integer

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

    virtual_env_type

    String

    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 a data disk image, the value is DataImage.
    • For a BMS image, the value is Ironic.
    • For an ISO image, the value is IsoImage.

    __image_source_type

    String

    Specifies the image backend storage type. Only UDS is supported currently.

    __imagetype

    String

    Specifies the image type. The following types are supported:

    • Public image: The value is gold.
    • Private image: The value is private.
    • Shared image: The value is shared.
    • Marketplace image: The value is market.

    created_at

    String

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

    virtual_size

    Integer

    This parameter is unavailable currently.

    __originalimagename

    String

    Specifies the parent image ID.

    If the image is a public image or created from an image file, this value is left empty.

    __backup_id

    String

    Specifies the backup ID. To create an image using a backup, set the value to the backup ID. Otherwise, this value is left empty.

    __productcode

    String

    Specifies the product ID of a Marketplace image.

    __image_size

    String

    Specifies the size (bytes) of the image file.

    __data_origin

    String

    Specifies the image source.

    If the image is a public image, this parameter is left empty.

    __lazyloading

    String

    Specifies whether the image supports lazy loading. The value can be true, false, True, or False.

    active_at

    String

    Specifies the time when the image status became active.

    __image_displayname

    String

    Specifies the image name.

    __os_feature_list

    String

    Specifies additional attributes of the image. The value is a list (in JSON format) of advanced features supported by the image.

    __support_kvm

    String

    Specifies whether the image supports KVM. If yes, the value is true. Otherwise, this parameter is not required.

    __support_xen

    String

    Specifies whether the image supports Xen. If yes, the value is true. Otherwise, this parameter is not required.

    __support_largememory

    String

    Specifies whether the image supports large-memory ECSs. If the image supports large-memory ECSs, the value is true. Otherwise, this parameter is not required.

    __support_diskintensive

    String

    Specifies whether the image supports disk-intensive ECSs. If the image supports disk-intensive ECSs, the value is true. Otherwise, this parameter is not required.

    __support_highperformance

    String

    Specifies whether the image supports high-performance ECSs. If the image supports high-performance ECSs, the value is true. Otherwise, this parameter is not required.

    __support_xen_gpu_type

    String

    Specifies whether the image supports GPU-accelerated ECSs on the Xen platform. See Table 2 for its value. If the image does not support GPU-accelerated ECSs on the Xen platform, this parameter is not required. This attribute cannot co-exist with __support_xen and __support_kvm.

    __support_kvm_gpu_type

    String

    Specifies whether the image supports GPU-accelerated ECSs on the KVM platform. See Table 3 for its value.

    If the image does not support GPU-accelerated ECSs on the KVM platform, this parameter is not required. This attribute cannot co-exist with __support_xen and __support_kvm.

    __support_xen_hana

    String

    Specifies whether the image supports HANA ECSs on the Xen platform. If yes, the value is true. Otherwise, this parameter is not required.

    This attribute cannot co-exist with __support_xen and __support_kvm.

    __support_kvm_infiniband

    String

    Specifies whether the image supports ECSs with InfiniBand NICs on the KVM platform. If yes, the value is true. Otherwise, this parameter is not required.

    This attribute cannot co-exist with __support_xen.

    __system_support_market

    Boolean

    Specifies whether an image can be published in Marketplace.

    • true: supported
    • false: not supported

    __is_offshelved

    String

    Specifies whether the Marketplace image has been taken offline.

    • true: The image has been taken offline.
    • false: The image has not been taken offline.

    enterprise_project_id

    String

    Specifies the enterprise project that the image belongs to.

    • If the value is 0 or left blank, the image belongs to the default enterprise project.
    • If the value is a UUID, the image belongs to the enterprise project corresponding to the UUID.

      For more information about enterprise projects, see Enterprise Center.

    __root_origin

    String

    Specifies that the image is created from an external image file. Value: file

    __sequence_num

    String

    Specifies the ECS system disk slot number of the image.

    Example value: 0

    __support_fc_inject

    String

    Specifies whether the image supports password/private key injection using Cloud-Init.

    If the value is set to true, password/private key injection using Cloud-Init is not supported.

    NOTE:

    This parameter is valid only for ECS system disk images.

    hw_firmware_type

    String

    Specifies the ECS boot mode. Available values include:

    • bios indicates the BIOS boot mode.
    • uefi indicates the UEFI boot mode.

    hw_vif_multiqueue_enabled

    String

    Specifies whether the image supports NIC multi-queue. The value can be true or false.

    __support_arm

    String

    Specifies whether the image uses the ARM architecture. The value can be true or false.

    __support_agent_list

    String

    Specifies the agents configured for the image.

    • hss: The Host Security Service (HSS) agent is configured for the image.
    • ces: The host monitoring agent is configured for the image.

    Example value:

    "__support_agent_list": "hss,ces"

    NOTE:

    If the response does not contain this field, the HSS and host monitoring agents are not configured for the image.

    __system__cmkid

    String

    Specifies the ID of the key used to encrypt the image.

    __account_code

    String

    Specifies the charging identifier for the image.

    __support_amd

    String

    Specifies whether the image uses AMD's x86 architecture. The value can be true or false.

  • Example response
    STATUS CODE 200
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    {
      "images": [
        {
          "schema": "/v2/schemas/image",
          "min_disk": 100,
          "created_at": "2018-09-06T14:03:27Z",
          "__image_source_type": "uds",
          "container_format": "bare",
          "file": "/v2/images/bc6bed6e-ba3a-4447-afcc-449174a3eb52/file",
          "updated_at": "2018-09-06T15:17:33Z",
          "protected": true,
          "checksum": "d41d8cd98f00b204e9800998ecf8427e",
          "id": "bc6bed6e-ba3a-4447-afcc-449174a3eb52",
          "__isregistered": "true",
          "min_ram": 2048,
          "__lazyloading": "true",
          "owner": "1bed856811654c1cb661a6ca845ebc77",
          "__os_type": "Linux",
          "__imagetype": "gold",
          "visibility": "public",
          "virtual_env_type": "FusionCompute",
          "tags": [],
          "__platform": "CentOS",
          "size": 0,
          "__os_bit": "64",
          "__os_version": "CentOS 7.3 64bit",
          "name": "CentOS 7.3 64bit vivado",
          "self": "/v2/images/bc6bed6e-ba3a-4447-afcc-449174a3eb52",
          "disk_format": "zvhd2",
          "virtual_size": null,
          "hw_firmware_type": "bios",
          "status": "active",
          "__support_fc_inject":"true"
        },
        {
          "schema": "/v2/schemas/image",
          "min_disk": 100,
          "created_at": "2018-09-06T14:03:05Z",
          "__image_source_type": "uds",
          "container_format": "bare",
          "file": "/v2/images/0328c25e-c840-4496-81ac-c4e01b214b1f/file",
          "updated_at": "2018-09-25T14:27:40Z",
          "protected": true,
          "checksum": "d41d8cd98f00b204e9800998ecf8427e",
          "id": "0328c25e-c840-4496-81ac-c4e01b214b1f",
          "__isregistered": "true",
          "min_ram": 2048,
          "__lazyloading": "true",
          "owner": "1bed856811654c1cb661a6ca845ebc77",
          "__os_type": "Linux",
          "__imagetype": "gold",
          "visibility": "public",
          "virtual_env_type": "FusionCompute",
          "tags": [],
          "__platform": "CentOS",
          "size": 0,
          "__os_bit": "64",
          "__os_version": "CentOS 7.3 64bit",
          "name": "CentOS 7.3 64bit with sdx",
          "self": "/v2/images/0328c25e-c840-4496-81ac-c4e01b214b1f",
          "disk_format": "zvhd2",
          "virtual_size": null,
          "hw_firmware_type": "bios",
          "status": "active",
          "__support_fc_inject":"true"
        }
      ]
    }
    

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error. For details about the returned error code, 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.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    The service is unavailable.