Querying Details About an ECS

Function

This API is used to query details about an ECS by ECS ID.

URI

GET /v2.1/{project_id}/servers/{server_id}

GET /v2/{project_id}/servers/{server_id}

Table 1 describes the parameters in the URI.

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

server_id

Yes

Specifies the ECS ID.

Request

None

Response

Table 2 describes the response parameters.

Table 2 Response parameters

Parameter

Type

Description

server

Object

Specifies ECS information. For details, see Table 3.

Table 3 server 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:19Z".

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:19Z".

flavor

Object

Specifies the ECS flavor. For details, see Table 4.

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

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.

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.

Tag functions have been upgraded on the cloud platform. After the upgrade, the tag values returned by the system comply with the following rules:

  • The key and value of a tag are connected using an equal sign (=), for example, key=value.

  • If the value is empty, only the key is returned.

For more details about upgraded tag functions, see Tag Types.

os:scheduler_hints

Object

Specifies the ECS scheduling information. For details, see Table 11. This parameter is not available for BMSs. and is only available in DeH scenarios.

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.

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

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 4 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

Indicates an extended flavor field. For details, see os_extra_specs (flavor) Field Description.

This parameter is supported in microversion 2.47 and later.

Table 5 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 6 links field description

Parameter

Type

Description

rel

String

Specifies the shortcut link marker name.

href

String

Provides the corresponding 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 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 the value of tenancy is dedicated.

Example Request

Query details about a specified ECS.

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

Example Response

{
    "server": {
        "addresses": {
            "68269e6e-4a27-441b-8029-35373ad50bd9": [
                {
                    "addr": "192.168.0.3",
                    "version": 4,
                    "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:1b:35:78",
                    "OS-EXT-IPS:type": "fixed"
                }
            ]
        },
        "created": "2012-08-20T21:11:09Z",
        "flavor": {
            "id": "s3.xlarge.2",
            "links": [
                {
                    "href": "http://openstack.example.com/openstack/flavors/s3.xlarge.2",
                    "rel": "bookmark"
                }
            ]
        },
        "hostId": "65201c14a29663e06d0748e561207d998b343e1d164bfa0aafa9c45d",
        "id": "893c7791-f1df-4c3d-8383-3caae9656c62",
        "image": "",
        "links": [
            {
                "href": "http://openstack.example.com/v2/openstack/servers/893c7791-f1df-4c3d-8383-3caae9656c62",
                "rel": "self"
            },
            {
                "href": "http://openstack.example.com/openstack/servers/893c7791-f1df-4c3d-8383-3caae9656c62",
                "rel": "bookmark"
            }
        ],
        "metadata": {},
        "name": "new-server-test",
        "progress": 0,
        "status": "ACTIVE",
        "tenant_id": "openstack",
        "updated": "2012-08-20T21:11:09Z",
        "user_id": "fake"
    }
}

Returned Values

See Returned Values for General Requests.