Querying Details About ECSs

Function

This API is used to query details about ECSs.

URI

GET /v2.1/{project_id}/servers/detail?changes-since={changes-since}&image={image}&flavor={flavor}&name={name}&status={status}&limit={limit}&marker={marker}&not-tags={not-tags}&reservation_id={reservation_id}&ip={ip}

Table 1 describes the parameters in the URI.

Table 1 Path parameters

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

changes-since

No

String

Specifies the timestamp of the last ECS status update, which is used to filter out the ECSs with statuses updated later than the timestamp. The format must comply with ISO 8601 in the format of CCYY-MM-DDThh:mm:ss+/-hh:mm, for example, 2018-01-17T03:03:32Z.

image

No

String

Specifies the image ID.

When image is used as a filter criterion, other filter criteria and paging criteria are not supported. If both the image and other filter criteria are specified, the image filter criterion is used. If the query criteria do not contain the image filter criterion, API functions are not restricted.

flavor

No

String

Specifies the ECS flavor ID, which is fuzzy-matched.

name

No

String

Specifies the ECS name, which is fuzzy-matched.

status

No

String

Specifies the ECS status.

Options:

ACTIVE, BUILD, ERROR, HARD_REBOOT, MIGRATING, REBOOT, REBUILD, RESIZE, REVERT_RESIZE, SHUTOFF, and VERIFY_RESIZE

In microversion 2.37, the system will return an empty list for the status field out of the preceding options. In microversion 2.38 and later, the system will return error 400.

For details, see ECS Statuses.

limit

No

Integer

Specifies the upper limit on the number of returned results.

Each page contains 25 ECSs by default, and a maximum of 1,000 ECSs are returned. For large data volumes, you are advised to set this parameter to 100.

marker

No

String

Specifies the ECS ID to which the marker points. The query will start from its next ID.

tags

No

String

Queries ECSs with tags containing the specified value.

not-tags

No

String

Queries ECSs with tags not containing the specified value.

reservation_id

No

String

Specifies the ID returned when ECSs are created in a batch. This parameter is used to query ECSs created in a batch.

sort_key

No

String

Sorts query results by ECS attribute. The default sorting order is the reverse order of created_at.

The value can be created_at, auto_disk_config, availability_zone, display_description, display_name, host, host_name, image_ref, instance_type_id, kernel_id, key_name, launch_index, launched_at, locked_by, node, power_state, project_id, ramdisk_id, reservation_id, root_device_name, task_state, terminated_at, user_id, updated_at, uuid, or vm_state.

ip

No

String

Indicates the filtering result for IPv4 addresses, which are fuzzy-matched.

Request

None

Response

Table 3 describes the response parameters.

Table 3 Response parameters

Parameter

Type

Description

servers

Array of objects

Specifies the ECSs to be queried. For details, see Table 4.

servers_links

Array of objects

Specifies the link of the next page in pagination query. For details, see Table 6.

Table 4 servers field description

Parameter

Type

Description

name

String

Specifies the ECS name.

id

String

Specifies an ECS uniquely.

status

String

Specifies the ECS status.

Options:

ACTIVE, BUILD, DELETED, ERROR, HARD_REBOOT, MIGRATING, PAUSED, REBOOT, REBUILD, RESIZE, REVERT_RESIZE, SHUTOFF, SHELVED, SHELVED_OFFLOADED, SOFT_DELETED, SUSPENDED, and VERIFY_RESIZE

For details, see ECS Statuses.

created

String

Specifies the time when the ECS was created. The time is in the format of "2019-05-22T07:48:53Z".

updated

String

Specifies the last time when the ECS was updated, such as started, stopped, or restarted. The time is in the format of "2019-05-22T07:48:53Z".

flavor

Object

Specifies the ECS flavor.

For details, see Table 5.

image

Object

Specifies the ECS image information. For an ECS created using an image, the image ID and link are returned.

For details, see Table 11.

tenant_id

String

Specifies the ID of the tenant to which the ECS belongs. The parameter value is the same as the project ID specified by project_id.

key_name

String

Specifies the SSH key name.

user_id

String

Specifies the ID of the user to which an ECS belongs.

metadata

Object

Specifies the ECS metadata.

hostId

String

Specifies the host ID of the ECS.

addresses

Object

Specifies the network addresses of an ECS.

The structure is Map<String, Object>.

  • The key indicates the network name, for example, demo_net.

  • The value indicates the network attribute specified in Table 7.

security_groups

Array of objects

Specifies the security groups to which the ECS belongs.

For details, see Table 9.

links

Array of objects

Specifies ECS shortcut links.

For details, see Table 6.

os:scheduler_hints

Object

Specifies the ECS scheduling information. For details, see Table 12. This parameter is only available for DeHs.

OS-DCF:diskConfig

String

Specifies the disk configuration mode. This is an extended attribute. This field is valid for the ECS started using an image.

Options:

  • AUTO: This API uses a single partition to build an ECS with the target disk size. The API automatically adjusts the file system to adapt to the entire partition.

  • MANUAL: This API uses the partitioning scheme in the source image and the file system to build the ECS. If the target disk size is large, the API does not partition the remaining disk space.

OS-EXT-AZ:availability_zone

String

Specifies the AZ ID. This is an extended attribute.

OS-EXT-SRV-ATTR:host

String

Specifies the name of the host on which the ECS is deployed. This is an extended attribute.

OS-EXT-SRV-ATTR:hypervisor_hostname

String

Specifies the hostname of the hypervisor. This is an extended attribute.

OS-EXT-SRV-ATTR:instance_name

String

Specifies the ECS ID. This is an extended attribute.

OS-EXT-STS:power_state

Integer

Specifies the ECS power status. This is an extended attribute.

Options: 0, 1, 2, 3, and 4

  • 0: pending

  • 1: running

  • 2: paused

  • 3: shutdown

  • 4: crashed

OS-EXT-STS:task_state

String

Specifies the ECS task status. This is an extended attribute.

For details about options, see ECS Statuses.

OS-EXT-STS:vm_state

String

Specifies the ECS status. This is an extended attribute.

Options:

ACTIVE, BUILDING, STOPPED, RESIZED, PAUSED, SUSPENDED, RESCUED, ERROR, DELETED, SOFT_DELETED, SHELVED, and SHELVED_OFFLOADED

For details, see ECS Statuses.

OS-SRV-USG:launched_at

String

Specifies the time when the ECS was started. This is an extended attribute. The time is in the format of "2019-05-22T07:48:19.000000".

OS-SRV-USG:terminated_at

String

Specifies the time when the ECS was deleted. This is an extended attribute.

The time is in the format of "2019-05-22T07:48:19.000000".

os-extended-volumes:volumes_attached

Array of objects

Specifies information about the EVS disks attached to the ECS.

For details, see Table 8.

fault

Object

Describes ECS faults.

This parameter is optional. It is returned when an error occurs on an ECS.

For details, see Table 10.

description

String

Describes the ECS.

This parameter is supported in microversion 2.19 and later.

host_status

String

Specifies the nova-compute status.

  • UP: The nova-compute status is normal.

  • UNKNOWN: The nova-compute status is unknown.

  • DOWN: the nova-compute status is abnormal.

  • MAINTENANCE: The nova-compute is in maintenance state.

  • Empty string: There is no host information on the ECS.

This parameter is supported in microversion 2.16 and later.

OS-EXT-SRV-ATTR:hostname

String

Specifies the name of the host accommodating the ECS.

This parameter is supported in microversion 2.3 and later.

OS-EXT-SRV-ATTR:reservation_id

String

Specifies the reserved ECS ID if multiple ECSs are created in a batch.

This parameter is supported in microversion 2.3 and later.

OS-EXT-SRV-ATTR:launch_index

Integer

Specifies the sequence in which ECSs created in a batch start.

This parameter is supported in microversion 2.3 and later.

OS-EXT-SRV-ATTR:kernel_id

String

Specifies the UUID of the kernel image if an AMI image is used. In other scenarios, leave this parameter blank.

This parameter is supported in microversion 2.3 and later.

OS-EXT-SRV-ATTR:ramdisk_id

String

Specifies the UUID of the Ramdisk image if an AMI image is used. In other scenarios, leave this parameter blank.

This parameter is supported in microversion 2.3 and later.

OS-EXT-SRV-ATTR:root_device_name

String

Specifies the device name of the ECS system disk.

This parameter is supported in microversion 2.3 and later.

OS-EXT-SRV-ATTR:user_data

String

Specifies the user data specified during ECS creation.

This parameter is supported in microversion 2.3 and later.

tags

Array of strings

Specifies ECS tags.

This parameter is supported in microversion 2.26 and later. If the microversion is not used for query, the response does not contain the tags field.

locked

Boolean

Specifies the ECS lock status, which is True when the ECS is locked and False when the ECS is unlocked.

This parameter is supported in microversion 2.9 and later.

accessIPv4

String

Reserved

accessIPv6

String

Reserved

config_drive

String

Reserved

progress

Integer

Reserved

Table 5 flavor field description

Parameter

Type

Description

id

String

Specifies the ECS ID.

This parameter is not supported in microversion 2.47 and later.

links

Array of objects

Specifies shortcut links for ECS types. For details, see Table 6.

This parameter is not supported in microversion 2.47 and later.

vcpus

Integer

Specifies the number of vCPUs in the ECS flavor.

This parameter is supported in microversion 2.47 and later.

ram

Integer

Specifies the memory size (MB) in the ECS flavor.

This parameter is supported in microversion 2.47 and later.

disk

Integer

Specifies the system disk size in the ECS flavor. Value 0 indicates that the disk size is not limited.

This parameter is supported in microversion 2.47 and later.

ephemeral

Integer

Reserved

This parameter is supported in microversion 2.47 and later.

swap

Integer

Reserved

This parameter is supported in microversion 2.47 and later.

original_name

String

Specifies the name of the ECS flavor.

This parameter is supported in microversion 2.47 and later.

extra_specs

Object

Extended flavor field

For details, see Data Structure for Querying Details About Specifications.

This parameter is supported in microversion 2.47 and later.

Table 6 servers_links and links field description

Parameter

Type

Description

rel

String

Specifies the shortcut link marker name.

href

String

Specifies the shortcut link.

Table 7 Data structure of the network which an ECS accesses

Parameter

Type

Description

addr

String

Specifies the IP address.

version

Integer

Specifies the type of an IP address. The value of this parameter can be 4 or 6.

  • 4: The type of the IP address is IPv4.

  • 6: The type of the IP address is IPv6.

OS-EXT-IPS-MAC:mac_addr

String

Specifies the MAC address. This is an extended attribute.

OS-EXT-IPS:type

String

Specifies the IP address assignment mode. This is an extended attribute.

Table 8 os-extended-volumes:volumes_attached field description

Parameter

Type

Description

id

String

Specifies the EVS disk ID.

delete_on_termination

Boolean

Specifies whether to delete additional disks when deleting the ECS.

By default, this parameter is set to False.

This parameter is supported in microversion 2.3 and later.

Table 9 security_groups field description

Parameter

Type

Description

name

String

Specifies the security group name or UUID.

Table 10 fault field description

Parameter

Type

Description

code

Integer

Specifies the error code.

created

String

Specifies the time when an error occurred.

message

String

Describes an error.

details

String

Specifies details about an error. This parameter is optional and is returned only when it is not empty.

Table 11 image field description

Parameter

Type

Description

id

String

Specifies the image ID.

links

Array of objects

Specifies shortcut links for ECS images. For details, see Table 6.

Table 12 os:scheduler_hints parameters

Parameter

Mandatory

Type

Description

tenancy

No

Array of strings

Creates ECSs on a dedicated or shared host.

The value of this parameter can be dedicated or shared.

dedicated_host_id

No

Array of strings

Specifies the DeH ID.

This parameter takes effect only when tenancy is set to dedicated.

Example Request

Query details about ECSs.

GET https://{endpoint}/v2.1/{project_id}/servers/detail

Example Response

{
    "servers": [
        {
            "addresses": {
                "68269e6e-4a27-441b-8029-35373ad50bd9": [
                    {
                        "addr": "192.168.0.3",
                        "version": 4
                    }
                ]
            },
            "created": "2012-09-07T16:56:37Z",
            "flavor": {
                "id": "s3.xlarge.2",
                "links": [
                    {
                        "href": "http://openstack.example.com/openstack/flavors/s3.xlarge.2",
                        "rel": "bookmark"
                    }
                ]
            },
            "hostId": "16d193736a5cfdb60c697ca27ad071d6126fa13baeb670fc9d10645e",
            "id": "05184ba3-00ba-4fbc-b7a2-03b62b884931",
            "image": "",
            "links": [
                {
                    "href": "http://openstack.example.com/v2/openstack/servers/05184ba3-00ba-4fbc-b7a2-03b62b884931",
                    "rel": "self"
                },
                {
                    "href": "http://openstack.example.com/openstack/servers/05184ba3-00ba-4fbc-b7a2-03b62b884931",
                    "rel": "bookmark"
                }
            ],
            "metadata": {},
            "name": "new-server-test",
            "progress": 0,
            "status": "ACTIVE",
            "tenant_id": "openstack",
            "updated": "2012-09-07T16:56:37Z",
            "user_id": "fake"
        }
    ]
}

Returned Values

See Returned Values for General Requests.