查询虚拟机调度历史

API请求

URLs

GET zstack//v1/vm/sched-history
GET zstack//v1/vm/sched-history/{vmInstanceUuid}

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/vm/sched-history?q=vmInstanceUuid=15b5b8ab631d300592bf83d66331f914
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm/sched-history/{vmInstanceUuid}?q=vmInstanceUuid=4240a319fabf3728960d1d7639f3fc0f

可查询字段

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

API返回

{
  "inventories": [
    {
      "id": 0.0,
      "vmInstanceUuid": "ec8fe40b4b0a38bc8f195bfc8bfc72e9",
      "accountUuid": "b07dda064256343c894cecfa5d50b42c",
      "schedType": "VMHA",
      "success": true,
      "lastHostUuid": "d4d26f65cfff3fafb98d3da284290455",
      "destHostUuid": "bc001bb4d762395db4b2ed97c6d6dae3"
    }
  ]
}
名字类型描述起始版
successboolean 0.6
inventoriesList详情参考inventories4.4.24
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error0.6

inventories

名字类型描述起始版本
vmInstanceUuidString虚拟机UUID4.4.24
accountUuidString账户UUID4.4.24
schedTypeString 4.4.24
successBoolean 4.4.24
lastHostUuidString 4.4.24
destHostUuidString 4.4.24
createDateTimestamp创建时间4.4.24
lastOpDateTimestamp最后一次修改时间4.4.24

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10014.4.24
descriptionString错误的概要描述4.4.24
detailsString错误的详细信息4.4.24
elaborationString保留字段,默认为null4.4.24
opaqueLinkedHashMap保留字段,默认为null4.4.24
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null4.4.24

SDK示例

Java SDK

QueryVmSchedHistoryAction action = new QueryVmSchedHistoryAction();
action.conditions = asList("vmInstanceUuid=b35d14e4af4c3f4c8f745e73df083020");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVmSchedHistoryAction.Result res = action.call();

Python SDK

QueryVmSchedHistoryAction action = QueryVmSchedHistoryAction()
action.conditions = ["vmInstanceUuid=f9bd0652c3843cb285c2e7b8c9f4561b"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVmSchedHistoryAction.Result res = action.call()