文档目录

查询资源的虚拟化软件信息(QueryKvmHypervisorInfo)

API请求

URLs
GET zstack/v1/hosts/kvm/hypervisor/info
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/hosts/kvm/hypervisor/info?q=uuid=dd025c0199ef3b7080120db73772234f

可查询字段

运行CLI命令行工具,输入QueryHost并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "a3097e5ebe8a35929e1f2fe4304893f1",
      "hypervisor": "qemu-kvm",
      "version": "4.2.0-632.g6a6222b.el7",
      "matchState": "Matched",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 查询是否成功 4.6.21
inventories List 详情参考inventories 4.6.21
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.6.21
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,可以为物理机或云主机的 UUID 4.6.21
hypervisor String 虚拟化软件名称,比如qemu-kvm 4.6.21
version String 版本号,比如4.2.0-632.g6a6222b.el7 4.6.21
matchState String 和预期版本号的匹配状态,可能的值为Matched, Unmatched,Unknown 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 4.6.21
description String 错误的概要描述 4.6.21
details String 错误的详细信息 4.6.21
elaboration String 保留字段,默认为null 4.6.21
opaque LinkedHashMap 保留字段,默认为null 4.6.21
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 4.6.21

SDK示例

Java SDK
QueryKvmHypervisorInfoAction action = new QueryKvmHypervisorInfoAction();
action.conditions = asList("uuid=0601103239cd30c2bd738b98d4440199");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryKvmHypervisorInfoAction.Result res = action.call();
Python SDK
QueryKvmHypervisorInfoAction action = QueryKvmHypervisorInfoAction()
action.conditions = ["uuid=838e20e529cc3a19a9f0efa50e9e2409"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryKvmHypervisorInfoAction.Result res = action.call()
开发手册 | 4.8.38 | ZStack Cloud · ZCF | ZStack 资源中心