Este conteúdo foi traduzido por máquina para sua conveniência e a Huawei Cloud não pode garantir que o conteúdo foi traduzido com precisão. Para exibir o conteúdo original, use o link no canto superior direito para mudar para a página em inglês.
Atualizado em 2022-11-08 GMT+08:00

Consulta de detalhes sobre os ECS

Função

Essa API é usada para consultar os ECS de acordo com critérios de pesquisa e detalhes sobre os ECS.

As informações que podem ser consultadas incluem modos de faturamento do ECS e status congelados do ECS.

URI

GET /v1/{project_id}/cloudservers/detail?flavor={flavor}&name={name}&status={status}&limit={limit}&offset={offset}&not-tags={not-tags}&reservation_id={reservation_id}&&tags={tags}&ip={ip}

Tabela 1 descreve os parâmetros no URI.
Tabela 1 Parâmetros de caminho

Parâmetro

Obrigatório

Descrição

project_id

Sim

Especifica a ID do projeto.

Para obter detalhes de como conseguir o ID de domínio, consulte Obtenção de um ID de projeto.

Tabela 2 Parâmetros de consulta

Parâmetro

Obrigatório

Tipo

Descrição

offset

Não

Integer

Especifica um número de página.

O valor deve ser maior ou igual a 0 e o valor padrão é 1.

Se o valor for 0, a primeira página será exibida, o que é o mesmo que o valor 1.

flavor

Não

String

Especifica o ID do sabor. Para obter detalhes sobre as variações publicadas, consulte ECS Types no Guia de usuário do Elastic Cloud Server.

name

Não

String

Especifica o nome do ECS, que é correspondido fuzzy.

status

Não

String

Especifica o status do ECS.

Opções:

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

Para mais detalhes, consulte Estados de ECS.

NOTA:

Quando um ECS está em um estado intermediário, os status que podem ser obtidos são os seguintes:

  • ACTIVE: ACTIVE, REBOOT, HARD_REBOOT, REBUILD, ou MIGRATING
  • SHUTOFF: SHUTOFF, RESIZE, ou REBUILD
  • ERROR: ERROR ou REBUILD
  • VERIFY_RESIZE: VERIFY_RESIZE ou REVERT_RESIZE

limit

Não

Integer

Especifica o número máximo dos ECS em uma página.

Cada página contém os 25 ECS por padrão, e um máximo dos 1000 ECS são retornados. Para grandes volumes de dados, é aconselhável definir o valor como 100.

tags

Não

String

Obtém os ECS com tags especificadas.

not-tags

Não

String

Consulta os ECS cujo campo tag não contém o valor especificado.

Por exemplo, se a lista ECS consultada não deve conter os BMS, defina este parâmetro da seguinte forma: not-tags=__type_baremetal

reservation_id

Não

String

Especifica o ID retornado quando os ECS são criados em um lote usando a API Nova do OpenStack. Esse parâmetro é usado para consultar os ECS criados em um lote.

ip

Não

String

Especifica o resultado da filtragem para endereços IPv4, que são correspondidos fuzzy.

Esses endereços IP são endereços IP privados do ECS.

all_tenants

Não

boolean

Se esse parâmetro for definido como true, os ECS de todos os locatários serão retornados. O valor padrão é false.

availability_zone

Não

string

Especifica a AZ em que o ECS reside.

deleted

Não

boolean

Se esse parâmetro for definido como true, os ECS excluídos serão retornados. O valor padrão é false.

Solicitação

Nenhum

Resposta

Tabela 3 descreve os parâmetros de resposta.
Tabela 3 Parâmetros de resposta

Parâmetro

Tipo

Descrição

servers

Array of objects

Especifica detalhes sobre os ECS. Para mais detalhes, consulte Tabela 3.

count

Integer

Especifica o número total dos ECS.

Exemplo de solicitação

GET https://{endpoint}/v1/{project_id}/cloudservers/detail?offset=1&limit=10

Exemplo de resposta

{
	"count": 4,
	"servers": [{
                "fault": null,
		"id": "b37fd80e-ac67-4d02-b9f1-9891c9c0fabf",
		"name": "ecs-yuankai2",
		"addresses": {
			"164489f6-cbf7-45b4-b6d0-d407c48cf7fc": [{
				"version": "4",
				"addr": "192.168.0.206",
				"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:95:88:3f",
				"OS-EXT-IPS:port_id": "7b5d615c-186d-4646-9cb8-444addfe9b92",
				"OS-EXT-IPS:type": "fixed"
			},
			{
				"version": "4",
				"addr": "192.168.0.8",
				"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:1d:88:43",
				"OS-EXT-IPS:port_id": "dda2027b-2f03-497b-8d42-620da2baacc3",
				"OS-EXT-IPS:type": "fixed"
			}]
		},
		"flavor": {
			"disk": "0",
			"vcpus": "1",
			"ram": "1024",
			"id": "c1.medium",
			"name": "c1.medium"
		},
		"accessIPv4": "",
		"accessIPv6": "",
		"status": "SHUTOFF",
                "image": {
                       "id": "1ce5800a-e487-4c1b-b264-3353a39e2b4b"
                 },
		"hostId": "f92345b97fd291f67a29ed735a82a8983f370175d2ba3d18d66893f4",
		"updated": "2018-08-14T07:26:49Z",
		"created": "2018-08-13T13:46:09Z",
		"metadata": {
			"metering.image_id": "af60e0d5-6952-4f3d-b0ed-31bb19d4a692",
			"metering.resourcespeccode": "c1.medium.linux",
			"image_name": "HEC_Public_Cloudinit_CentOS_7.4_64bit",
			"metering.product_id": "00301-253164-0--0",
			"os_bit": "64",
			"lockSourceId": "",
			"lockScene": "",
			"metering.order_id": "CS1808132145NRVRE",
			"lockCheckEndpoint": "",
			"metering.imagetype": "gold",
			"lockSource": "",
			"metering.resourcetype": "1",
			"vpc_id": "164489f6-cbf7-45b4-b6d0-d407c48cf7fc",
			"os_type": "Linux",
			"charging_mode": "1"
		},
		"tags": [],
		"description": "ecs-4cff",
		"locked": false,
		"config_drive": "",
		"tenant_id": "edcb94a885a84ed3a3fdf8ea4d2741da",
		"user_id": "bb7f23e27e7e46f3aaceb5f53a158bdc",
		"os-extended-volumes:volumes_attached": [{
			"device": "/dev/sda",
			"bootIndex": "0",
			"id": "2edc879f-022e-4bd6-b079-95a27564d449",
			"delete_on_termination": "false"
		}],
                "OS-EXT-STS:task_state": null,
		"OS-EXT-STS:power_state": 4,
		"OS-EXT-STS:vm_state": "stopped",
		"OS-EXT-SRV-ATTR:host": "az1.dc1",
		"OS-EXT-SRV-ATTR:instance_name": "instance-00137941",
		"OS-EXT-SRV-ATTR:hypervisor_hostname": "nova001@248",
		"OS-DCF:diskConfig": "MANUAL",
		"OS-EXT-AZ:availability_zone":"az1-dc1", //AZ name
		"os:scheduler_hints": {
			
		},
		"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
		"OS-EXT-SRV-ATTR:ramdisk_id": "",
		
		"OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKZWNobyAncm9vdDokNiRKQ2FzUWQkbm5wVmhJUFZlNVMwc3pXbnJGLnZVZ1FCWk4xTEo5Vy8wd09WTmFZaWpBRXdtRnhuQmZaTllVZXhBWktVWFVTeVhEeERuSUMzV2JjZEJyQUVBZkZvLy8nIHwgY2hwYXNzd2QgLWU7",
		"OS-SRV-USG:launched_at": "2018-08-13T13:46:46.000000",
		"OS-EXT-SRV-ATTR:kernel_id": "",
		"OS-EXT-SRV-ATTR:launch_index": 0,
		"host_status": "UP",
		"OS-EXT-SRV-ATTR:reservation_id": "r-a8mg9vwr",
		"OS-EXT-SRV-ATTR:hostname": "ecs-4cff",
		"sys_tags": [{
			"key": "_sys_enterprise_project_id",
			"value": "441d5677-b76a-4dd4-a97a-ef7fd633c095"
		}],
		"security_groups": [{
                        "id": "71846bf6-1cda-4515-8590-3707be295e76",
			"name": "Sys-FullAccess"
		},
		{
                        "id": "b1786350-da65-11e7-b312-0255ac101b03",
			"name": "default"
		}]
	},
	{
                "fault": null,
		"id": "8380dcc9-0eac-4407-9f9e-df8c9eddeacd",
		"name": "ecs-f680",
		"addresses": {
			"164489f6-cbf7-45b4-b6d0-d407c48cf7fc": [{
				"version": "4",
				"addr": "192.168.0.218",
				"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:bb:b3:fe",
				"OS-EXT-IPS:port_id": "240c696f-68d8-4f3f-941d-fecf2b375132",
				"OS-EXT-IPS:type": "fixed"
			}]
		},
		"flavor": {
			"disk": "0",
			"vcpus": "1",
			"ram": "1024",
			"id": "c1.medium",
			"name": "c1.medium"
		},
		"accessIPv4": "",
		"accessIPv6": "",
		"status": "SHUTOFF",
                "image": {
                       "id": "1ce5800a-e487-4c1b-b264-3353a39e2b4b"
                 },
		"hostId": "f92345b97fd291f67a29ed735a82a8983f370175d2ba3d18d66893f4",
		"updated": "2018-08-14T03:01:00Z",
		"created": "2018-08-13T13:38:29Z",
		"metadata": {
			"metering.image_id": "af60e0d5-6952-4f3d-b0ed-31bb19d4a692",
			"metering.imagetype": "gold",
			"metering.resourcespeccode": "c1.medium.linux",
			"image_name": "HEC_Public_Cloudinit_CentOS_7.4_64bit",
			"metering.resourcetype": "1",
			"os_bit": "64",
			"vpc_id": "164489f6-cbf7-45b4-b6d0-d407c48cf7fc",
			"os_type": "Linux",
			"charging_mode": "0"
		},
		"tags": [],
		"description": "ecs-f680",
		"locked": false,
		"config_drive": "",
		"tenant_id": "edcb94a885a84ed3a3fdf8ea4d2741da",
		"user_id": "61ee747d36bf421fa25c51a3b9565046",
		"os-extended-volumes:volumes_attached": [{
			"device": "/dev/sda",
			"bootIndex": "0",
			"id": "3721b948-9c2f-4980-90ad-b2a16811f58c",
			"delete_on_termination": "false"
		}],
                "OS-EXT-STS:task_state": null,
		"OS-EXT-STS:power_state": 4,
		"OS-EXT-STS:vm_state": "stopped",
		"OS-EXT-SRV-ATTR:host": "az1.dc1",
		"OS-EXT-SRV-ATTR:instance_name": "instance-00137937",
		"OS-EXT-SRV-ATTR:hypervisor_hostname": "nova001@248",
		"OS-DCF:diskConfig": "MANUAL",
		"OS-EXT-AZ:availability_zone":"az1-dc1", //AZ name
		"os:scheduler_hints": {
		},
		"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
		"OS-EXT-SRV-ATTR:ramdisk_id": "",
		
		"OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKZWNobyAncm9vdDokNiR5aG9aeFIkVE00OWlwSGQ2OEFWcjlTMTFXNEZrZmFYTENVbEkvd0xVTmdSVjhOb0dCem5WOWFsU1lEN0ZNSHc0VmtwdU9GOERyLncudGUzVmRHLnVmY005elVZSDEnIHwgY2hwYXNzd2QgLWU7",
		"OS-SRV-USG:launched_at": "2018-08-13T13:38:53.000000",
		"OS-EXT-SRV-ATTR:kernel_id": "",
		"OS-EXT-SRV-ATTR:launch_index": 0,
		"host_status": "UP",
		"OS-EXT-SRV-ATTR:reservation_id": "r-7e2g78rq",
		"OS-EXT-SRV-ATTR:hostname": "ecs-f680",
		"sys_tags": [{
			"key": "_sys_enterprise_project_id",
			"value": "441d5677-b76a-4dd4-a97a-ef7fd633c095"
		}],
		"security_groups": [{
			"name": "test"
		}]
	},
	{
                "fault": null,
		"id": "fb70fed9-5774-44a7-ad4a-af3ea2c2da61",
		"name": "ecs-3993",
		"addresses": {
			"00159d7d-b3c3-4108-8bc4-6658814e6422": [{
				"version": "4",
				"addr": "192.168.20.83",
				"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:a9:8d:88",
				"OS-EXT-IPS:port_id": "579ab762-bf89-435e-80ad-a8bdd25119c5",
				"OS-EXT-IPS:type": "fixed"
			}]
		},
		"flavor": {
			"disk": "0",
			"vcpus": "1",
			"ram": "1024",
			"id": "c1.medium",
			"name": "c1.medium"
		},
		"accessIPv4": "",
		"accessIPv6": "",
		"status": "SHUTOFF",
                "image": {
                       "id": "1ce5800a-e487-4c1b-b264-3353a39e2b4b"
                 },
		"hostId": "f92345b97fd291f67a29ed735a82a8983f370175d2ba3d18d66893f4",
		"updated": "2018-08-14T03:01:03Z",
		"created": "2018-08-13T13:38:02Z",
		"metadata": {
			"metering.image_id": "af60e0d5-6952-4f3d-b0ed-31bb19d4a692",
			"metering.imagetype": "gold",
			"metering.resourcespeccode": "c1.medium.linux",
			"image_name": "HEC_Public_Cloudinit_CentOS_7.4_64bit",
			"metering.resourcetype": "1",
			"os_bit": "64",
			"vpc_id": "00159d7d-b3c3-4108-8bc4-6658814e6422",
			"os_type": "Linux",
			"charging_mode": "0"
		},
		"tags": [],
		"description": "ecs-3993",
		"locked": false,
		"config_drive": "",
		"tenant_id": "edcb94a885a84ed3a3fdf8ea4d2741da",
		"user_id": "eb4698fe015848e9a3e86cc9956e54fa",
		"key_name": "KeyPair-3b38",
		"os-extended-volumes:volumes_attached": [{
			"device": "/dev/sda",
			"bootIndex": "0",
			"id": "85bfbc4f-7733-419a-b171-c00585abf926",
			"delete_on_termination": "false"
		}],
                "OS-EXT-STS:task_state": null,
		"OS-EXT-STS:power_state": 4,
		"OS-EXT-STS:vm_state": "stopped",
		"OS-EXT-SRV-ATTR:host": "az1.dc1",
		"OS-EXT-SRV-ATTR:instance_name": "instance-00137936",
		"OS-EXT-SRV-ATTR:hypervisor_hostname": "nova001@248",
		"OS-DCF:diskConfig": "MANUAL",
		"OS-EXT-AZ:availability_zone":"az1-dc1", //AZ name
		"os:scheduler_hints": {
		},
		"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
		"OS-EXT-SRV-ATTR:ramdisk_id": "",
		
		"OS-SRV-USG:launched_at": "2018-08-13T13:38:24.000000",
		"OS-EXT-SRV-ATTR:kernel_id": "",
		"OS-EXT-SRV-ATTR:launch_index": 0,
		"host_status": "UP",
		"OS-EXT-SRV-ATTR:reservation_id": "r-uzsewxii",
		"OS-EXT-SRV-ATTR:hostname": "ecs-3993",
		"sys_tags": [{
			"key": "_sys_enterprise_project_id",
			"value": "441d5677-b76a-4dd4-a97a-ef7fd633c095"
		}],
		"security_groups": [{
			"name": "test"
		},
		{
			"name": "default"
		}]
	},
	{
                "fault": null,
		"id": "e3d3f219-b445-4a7a-8f00-e31412481f8c",
		"name": "ecs-1f30",
		"addresses": {
			"00159d7d-b3c3-4108-8bc4-6658814e6422": [{
				"version": "4",
				"addr": "192.168.20.197",
				"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:41:5a:32",
				"OS-EXT-IPS:port_id": "cfa2e055-54fb-427a-bde4-128bda47ae5c",
				"OS-EXT-IPS:type": "fixed"
			}]
		},
		"flavor": {
			"disk": "0",
			"vcpus": "1",
			"ram": "1024",
			"id": "c1.medium",
			"name": "c1.medium"
		},
		"accessIPv4": "",
		"accessIPv6": "",
		"status": "ACTIVE",
                "image": {
                       "id": "1ce5800a-e487-4c1b-b264-3353a39e2b4b"
                 },
		"progress": 0,
		"hostId": "f92345b97fd291f67a29ed735a82a8983f370175d2ba3d18d66893f4",
		"updated": "2018-08-15T08:16:01Z",
		"created": "2018-08-13T11:57:29Z",
		"metadata": {
			"sadfasfasf": "sdffffd",
			"metering.order_id": "CS180813193577ORO",
			"metering.imagetype": "gold",
			"metering.resourcespeccode": "c1.medium.win",
			"metering.image_id": "65cb40e6-f67e-4bef-a1e7-808166a5999d",
			"image_name": "HEC_Public_Windows2008R2_Ent_64bit40G_English",
			"aaaaaa": "0",
			"metering.resourcetype": "1",
			"aaaa": "0",
			"metering.product_id": "00301-146042-0--0",
			"os_bit": "64",
			"vpc_id": "00159d7d-b3c3-4108-8bc4-6658814e6422",
			"os_type": "Windows",
			"charging_mode": "1"
		},
		"tags": [],
		"description": "ecs-1f30",
		"locked": false,
		"config_drive": "",
		"tenant_id": "edcb94a885a84ed3a3fdf8ea4d2741da",
		"user_id": "bb7f23e27e7e46f3aaceb5f53a158bdc",
		"key_name": "Autotest_Init_TC_OriginalAPI_Create_Keypairs_02_keypair",
		"os-extended-volumes:volumes_attached": [{
			"device": "/dev/sda",
			"bootIndex": "0",
			"id": "5043f66b-a0d8-4eb2-8c48-49976bcdc253",
			"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": "az1.dc1",
		"OS-EXT-SRV-ATTR:instance_name": "instance-0013772d",
		"OS-EXT-SRV-ATTR:hypervisor_hostname": "nova001@248",
		"OS-DCF:diskConfig": "MANUAL",
		"OS-EXT-AZ:availability_zone":"az1-dc1", //AZ name
		"os:scheduler_hints": {
		},
		"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
		"OS-EXT-SRV-ATTR:ramdisk_id": "",
		
		"OS-SRV-USG:launched_at": "2018-08-13T11:57:53.576640",
		"OS-EXT-SRV-ATTR:kernel_id": "",
		"OS-EXT-SRV-ATTR:launch_index": 0,
		"host_status": "UP",
		"OS-EXT-SRV-ATTR:reservation_id": "r-xmjj4pnm",
		"OS-EXT-SRV-ATTR:hostname": "ecs-1f30",
		"sys_tags": [{
			"key": "_sys_enterprise_project_id",
			"value": "441d5677-b76a-4dd4-a97a-ef7fd633c095"
		}],
		"security_groups": [{
			"name": "default"
		}]
	}]
}

Valores retornados

Consulte Valores retornados para solicitações gerais.

Códigos de erro

Consulte Códigos de erro.