API请求
URLs
GET zstack/v1/container/native/hostGET zstack/v1/container/native/host/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/container/native/host?q=uuid=536f4ab4b6023ddf9950c6fa584da483curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/container/native/host/a18dfe3e2f123f9ca19a202129663818可查询字段
运行zstack-cli命令行工具,输入QueryNativeHost并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"zoneUuid": "5abd68b3e648472f8cf8c77795186990",
"name": "example",
"uuid": "1758fe38a8cd4887ab445ff46aaf432f",
"clusterUuid": "e2ecc4b7bc9342e3a7522b8fed4db0f7",
"managementIp": "127.0.0.1",
"hypervisorType": "KVM",
"cpuSockets": 2
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 查询接口调用是否成功 | 5.3.6 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 5.3.6 |
| inventories | List | 详情参考inventories | 5.3.6 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 5.3.6 |
| description | String | 错误的概要描述 | 5.3.6 |
| details | String | 错误的详细信息 | 5.3.6 |
| elaboration | String | 保留字段,默认为null | 5.3.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 5.3.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 5.3.6 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| endpointUuid | String | 容器管理端点UUID | 5.3.6 |
| zoneUuid | String | 区域UUID | 5.3.6 |
| name | String | 资源名称 | 5.3.6 |
| uuid | String | 资源的UUID,唯一标示该资源 | 5.3.6 |
| clusterUuid | String | 集群UUID | 5.3.6 |
| description | String | 资源的详细描述 | 5.3.6 |
| managementIp | String | 管理IP | 5.3.6 |
| hypervisorType | String | hypervisor类型 | 5.3.6 |
| state | String | 启用状态 | 5.3.6 |
| status | String | 连接状态 | 5.3.6 |
| totalCpuCapacity | Long | 总CPU容量 | 5.3.6 |
| availableCpuCapacity | Long | 可用的CPU容量 | 5.3.6 |
| cpuSockets | Integer | CPU插槽数量 | 5.3.6 |
| totalMemoryCapacity | Long | 总内存容量 | 5.3.6 |
| availableMemoryCapacity | Long | 可用的内存容量 | 5.3.6 |
| cpuNum | Integer | CPU数量 | 5.3.6 |
| ipmiAddress | String | IPMI地址 | 5.3.6 |
| ipmiUsername | String | IPMI用户名 | 5.3.6 |
| ipmiPort | Integer | IPMI端口 | 5.3.6 |
| ipmiPowerStatus | String | IPMI电源状态 | 5.3.6 |
| architecture | String | 架构 | 5.3.6 |
| createDate | Timestamp | 创建时间 | 5.3.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 5.3.6 |
| cpuStatus | HwMonitorStatus | 详情参考cpuStatus | 5.3.6 |
| memoryStatus | HwMonitorStatus | 详情参考memoryStatus | 5.3.6 |
| diskStatus | HwMonitorStatus | 详情参考diskStatus | 5.3.6 |
| nicStatus | HwMonitorStatus | 详情参考nicStatus | 5.3.6 |
| gpuStatus | HwMonitorStatus | 详情参考gpuStatus | 5.3.6 |
| powerSupplyStatus | HwMonitorStatus | 详情参考powerSupplyStatus | 5.3.6 |
| fanStatus | HwMonitorStatus | 详情参考fanStatus | 5.3.6 |
| raidStatus | HwMonitorStatus | 详情参考raidStatus | 5.3.6 |
| temperatureStatus | HwMonitorStatus | 详情参考temperatureStatus | 5.3.6 |
#cpuStatus
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Normal | HwMonitorStatus | 正常状态 | 5.3.6 |
| Error | HwMonitorStatus | 错误状态 | 5.3.6 |
| Unknown | HwMonitorStatus | 未知状态 | 5.3.6 |
#memoryStatus
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Normal | HwMonitorStatus | 正常状态 | 5.3.6 |
| Error | HwMonitorStatus | 错误状态 | 5.3.6 |
| Unknown | HwMonitorStatus | 未知状态 | 5.3.6 |
#diskStatus
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Normal | HwMonitorStatus | 正常状态 | 5.3.6 |
| Error | HwMonitorStatus | 错误状态 | 5.3.6 |
| Unknown | HwMonitorStatus | 未知状态 | 5.3.6 |
#nicStatus
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Normal | HwMonitorStatus | 正常状态 | 5.3.6 |
| Error | HwMonitorStatus | 错误状态 | 5.3.6 |
| Unknown | HwMonitorStatus | 未知状态 | 5.3.6 |
#gpuStatus
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Normal | HwMonitorStatus | 正常状态 | 5.3.6 |
| Error | HwMonitorStatus | 错误状态 | 5.3.6 |
| Unknown | HwMonitorStatus | 未知状态 | 5.3.6 |
#powerSupplyStatus
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Normal | HwMonitorStatus | 正常状态 | 5.3.6 |
| Error | HwMonitorStatus | 错误状态 | 5.3.6 |
| Unknown | HwMonitorStatus | 未知状态 | 5.3.6 |
#fanStatus
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Normal | HwMonitorStatus | 正常状态 | 5.3.6 |
| Error | HwMonitorStatus | 错误状态 | 5.3.6 |
| Unknown | HwMonitorStatus | 未知状态 | 5.3.6 |
#raidStatus
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Normal | HwMonitorStatus | 正常状态 | 5.3.6 |
| Error | HwMonitorStatus | 错误状态 | 5.3.6 |
| Unknown | HwMonitorStatus | 未知状态 | 5.3.6 |
#temperatureStatus
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Normal | HwMonitorStatus | 正常状态 | 5.3.6 |
| Error | HwMonitorStatus | 错误状态 | 5.3.6 |
| Unknown | HwMonitorStatus | 未知状态 | 5.3.6 |
SDK示例
Java SDK
QueryNativeHostAction action = new QueryNativeHostAction();
action.conditions = asList("uuid=f1f679a0cb0731b7b4f72b859ad889b4");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryNativeHostAction.Result res = action.call();Python SDK
QueryNativeHostAction action = QueryNativeHostAction()
action.conditions = ["uuid=e18ae25ae13f351080848ea211a39d96"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryNativeHostAction.Result res = action.call()