Updated on 2023-05-29 GMT+08:00

Querying Details About an ECS

Function

This API is used to query details about an ECS.

The information can be queried includes the ECS billing mode and the ECS frozen status.

URI

GET /v1/{project_id}/cloudservers/{server_id}

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a 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

status

String

Specifies the ECS status.

Options:

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

For details, see ECS Statuses.

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-22T03:30:52Z".

hostId

String

Specifies the ID of the host where the ECS is deployed.

OS-EXT-SRV-ATTR:host

String

Specifies the name of the host on which the ECS is deployed.

addresses

Object

Specifies the network attribute of the 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 1.

key_name

String

Specifies the key pair that is used to authenticate an ECS.

image

Object

Specifies the ECS image. For details, see Table 8.

OS-EXT-STS:task_state

String

Specifies the ECS task status. This is an extended attribute. For details, see ECS Statuses.

OS-EXT-STS:vm_state

String

Specifies the ECS task status. This is an extended attribute. For details, see ECS Statuses.

OS-EXT-SRV-ATTR:instance_name

String

Specifies the ECS alias. This is an extended attribute.

OS-EXT-SRV-ATTR:hypervisor_hostname

String

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

flavor

Object

Specifies the ECS flavor.

For details, see Table 2.

id

String

Specifies the ECS ID in UUID format.

security_groups

Array of objects

Specifies the security groups of the ECS.

For details, see Table 3.

OS-EXT-AZ:availability_zone

String

Specifies the AZ of an ECS. This is an extended attribute.

user_id

String

Specifies the ID of the user for creating the ECS. The value is in UUID format.

name

String

Specifies the ECS name.

created

String

Specifies the time when the ECS was created.

The time is in the format of "2019-05-22T03:19:19Z".

tenant_id

String

Specifies the ID of the tenant to which the ECS belongs, which is the project ID in UUID format.

OS-DCF:diskConfig

String

Specifies the disk configuration type. This is an extended attribute.

Options:

  • MANUAL: The image space is not expanded.
  • AUTO: The image space of the system disk will be expanded to be as same as the flavor.

accessIPv4

String

Reserved

accessIPv6

String

Reserved

fault

Object

Specifies the cause of the ECS fault. For details, see Table 4.

progress

Integer

Specifies the ECS creation progress. The value ranges from 0 to 100.

OS-EXT-STS:power_state

Integer

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

Options:

  • 0: NOSTATE
  • 1: RUNNING
  • 4: SHUTDOWN

config_drive

String

Specifies the configuration driver.

metadata

Map<String,String>

Specifies the ECS metadata. For details, see Table 6.

NOTE:

Metadata includes system default fields and the fields set by users.

OS-SRV-USG:launched_at

String

Specifies the time when the ECS was started. The time is in the format of "2019-05-22T03:23:59.000000".

OS-SRV-USG:terminated_at

String

Specifies the time when the ECS was deleted.

The time is in the format of "2019-05-22T03:23:59.000000".

os-extended-volumes:volumes_attached

Array of objects

Specifies the disks attached to an ECS.

For details, see Table 5.

description

String

Describes the ECS.

host_status

String

Specifies the status of the host accommodating the ECS.

  • 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: The ECS does not have host information.

OS-EXT-SRV-ATTR:hostname

String

Specifies the host name of the ECS.

OS-EXT-SRV-ATTR:reservation_id

String

Specifies the ID reserved for the ECSs to be created in a batch. You can use this ID to obtain all the ECSs created in the batch.

OS-EXT-SRV-ATTR:launch_index

Integer

Specifies the sequence in which ECSs start if the ECSs are created in a batch. The value ranges from 0 to the number of ECSs created in the batch.

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.

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.

OS-EXT-SRV-ATTR:root_device_name

String

Specifies the device name of the ECS system disk. For example, if the device type of the system disk is VDB, the value of this parameter is /dev/vda. If the device type of the system disk is SCSI, the value of this parameter is /dev/sda.

OS-EXT-SRV-ATTR:user_data

String

Specifies the user data (information after encoding) configured during ECS creation.

locked

Boolean

Specifies whether an ECS is locked.

  • true: The ECS is locked.
  • false: The ECS is not locked.

tags

Array of strings

Specifies ECS tags.

os:scheduler_hints

Object

Specifies the ECS scheduling information. For details, see Table 13.

sys_tags

Array of objects

Specifies ECS system tags.

For details, see Table 7.

auto_terminate_time

String

Specifies the time when an ECS is automatically released.

NOTE:

The parameter value is null for yearly/monthly ECSs.

cpu_options

Object

Specifies the CPU options.

For details, see Table 4.

hypervisor

Object

Specifies the virtualization information. This is an extended attribute.

For details, see Table 5.

Table 4 cpu_options field description

Parameter

Type

Description

hw:cpu_threads

Integer

Specifies the number of CPU hyperthreads, which determines whether to enable CPU hyper-threading.

Values: 1 and 2

  • 1: Disable hyper-threading.
  • 2: Enable hyper-threading.

This parameter can be set to 1 (disabling hyper-threading) only when all of the following conditions are met:

  • The ECS is being created or resized.
  • The extra_specs parameter of the target flavor contains:
    • hw:cpu_policy, whose value is set to dedicated
    • hw:cpu_threads, whose value is set to 2
Table 5 hypervisor field description

Parameter

Type

Description

hypervisor_type

String

Specifies a virtualization type.

csd_hypervisor

String

This is a reserved parameter.

Example Request

GET https://{endpoint}/v1/{project_id}/cloudservers/{server_id}

Example Response

{
	"server": {
		"id": "4f4b3dfa-eb70-47cf-a60a-998a53bd598a",
		"name": "ecs-2ecf",
		"addresses": {
			"0431c5e5-bc94-4a44-8263-15da2a642435": [{
				"version": "4",
				"addr": "192.168.1.99",
				"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:df:18:6d",
				"OS-EXT-IPS:port_id": "23037c18-027a-44e5-b6b9-f8d8f113fe02",
				"OS-EXT-IPS:type": "fixed"
			}]
		},
		"flavor": {
			"disk": "0",
			"vcpus": "1",
			"ram": "1024",
			"id": "s3.small.1",
			"name": "s3.small.1"
		},
		"accessIPv4": "",
		"accessIPv6": "",
		"status": "ACTIVE",
		"progress": 0,
		"hostId": "c7145889b2e3202cd295ceddb1742ff8941b827b586861fd0acedf64",
		"updated": "2018-09-13T07:06:51Z",
		"created": "2018-09-13T07:03:44Z",
                "image": {
                        "id": "1ce5800a-e487-4c1b-b264-3353a39e2b4b"
                },
		"metadata": {
			"metering.order_id": "CS1809131459IGC24",
			"metering.image_id": "c71b64e7-4767-4406-afde-2c7c7ac2242c",
			"metering.imagetype": "gold",
			"metering.resourcespeccode": "s3.small.1.linux",
			"image_name": "HEC_Public_Cloudinit_Oracle_Linux_7.4_64bit_40G",
			"metering.resourcetype": "1",
			"metering.product_id": "00301-117024-0--0",
			"cascaded.instance_extrainfo": "pcibridge:2",
			"os_bit": "64",
			"vpc_id": "0431c5e5-bc94-4a44-8263-15da2a642435",
			"os_type": "Linux",
			"charging_mode": "1"
		},
		"tags": [],
		"description": "",
		"locked": false,
		"config_drive": "",
		"tenant_id": "ff2eb406effc455aba53174463eb9322",
		"user_id": "0bc5e11f91dd48849bb03b7c8a263b2c",
		"key_name": "KeyPair-d750",
		"os-extended-volumes:volumes_attached": [{
			"device": "/dev/vda",
			"bootIndex": "0",
			"id": "80c15cff-2473-4982-a816-d760cad6c42c",
			"delete_on_termination": "false"
		}],
                "OS-EXT-STS:task_state": null,
		"OS-EXT-STS:power_state": 1,
		"OS-EXT-STS:vm_state": "active",
		"OS-EXT-SRV-ATTR:host": "az21.dc1",
		"OS-EXT-SRV-ATTR:instance_name": "instance-0015147f",
		"OS-EXT-SRV-ATTR:hypervisor_hostname": "nova003@74",
                "OS-EXT-SRV-ATTR:user_data": null,
		"OS-DCF:diskConfig": "MANUAL",
		"OS-EXT-AZ:availability_zone":"az1-dc1", //AZ name
		"os:scheduler_hints": {
		},
		"OS-EXT-SRV-ATTR:root_device_name": "/dev/vda",
		"OS-EXT-SRV-ATTR:ramdisk_id": "",
		
		"OS-SRV-USG:launched_at": "2018-09-13T07:04:09.197749",
		"OS-EXT-SRV-ATTR:kernel_id": "",
		"OS-EXT-SRV-ATTR:launch_index": 0,
		"host_status": "UP",
		"OS-EXT-SRV-ATTR:reservation_id": "r-nrd8b5c4",
		"OS-EXT-SRV-ATTR:hostname": "ecs-2ecf",
		"sys_tags": [{
			"key": "_sys_enterprise_project_id",
			"value": "0"
		}],
		"security_groups": [{
			"name": "sg-95ec",
                        "id": "6505b5d1-7837-41eb-8a1c-869d4355baa3"
		}]
	}
}

Error Codes

See Error Codes.