设置云主机支持的屏幕数(SetVmMonitorNumber)
设置云主机支持的屏幕个数
API请求
URLs
PUT zstack/v1/vm-instances/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"setVmMonitorNumber": {
"monitorNumber": 2.0
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setVmMonitorNumber":{"monitorNumber":2.0}}' \
http://localhost:8080/zstack/v1/vm-instances/7cc2eec452593010bd2691f88385de7a/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.2 | |
| monitorNumber | Integer | body(包含在setVmMonitorNumber结构中) | 显示器个数 | 2.2 | |
| systemTags (可选) | List | body | 2.2 | ||
| userTags (可选) | List | body | 2.2 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
SetVmMonitorNumberAction action = new SetVmMonitorNumberAction();
action.uuid = "eb57f91af28a48dcbb6c56220a9b6d24";
action.monitorNumber = 2.0;
action.sessionId = "d8b870a03f97490fa6c39085cec24da7";
SetVmMonitorNumberAction.Result res = action.call();Python
SDK
SetVmMonitorNumberAction action = SetVmMonitorNumberAction()
action.uuid = "9a07d71b055e4da7a2f172e4cf7f337f"
action.monitorNumber = 2.0
action.sessionId = "56766234a9a54fe3b70c0e28b22fea5c"
SetVmMonitorNumberAction.Result res = action.call()