更新集群DRS

PUT/zstack/v1/clusters/drs/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateClusterDRS": {
    "name": "Test",
    "description": "Test",
    "automationLevel": "Manual",
    "thresholdDuration": 10,
    "state": "Enabled"
  },
  "systemTags": [],
  "userTags": []
}

上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateClusterDRS":{"name":"Test","description":"Test","automationLevel":"Manual","thresholdDuration":10,"state":"Enabled"}}' \
http://localhost:8080/zstack/v1/clusters/drs/ff067b9ad438337aa3d5beea6f504f00/actions

参数列表

名字

类型

位置

描述

可选值

起始版本

uuid

String

url

集群DRS的UUID,唯一标示该资源

 

4.0.0

name (可选)

String

body(包含在updateClusterDRS结构中)

资源名称

 

4.0.0

description (可选)

String

body(包含在updateClusterDRS结构中)

资源的详细描述

 

4.0.0

automationLevel (可选)

String

body(包含在updateClusterDRS结构中)

调度是手动触发还是自动触发

  • Automatic
  • Manual

4.0.0

thresholds (可选)

List

body(包含在updateClusterDRS结构中)

阈值判断项目

 

4.0.0

thresholdDuration (可选)

Integer

body(包含在updateClusterDRS结构中)

阈值判断时长。系统将查询从现在往前 thresholdDuration 的时段的负载数据进行统计,算出的结果和阈值比较来判断集群是否需要调度

 

4.0.0

state (可选)

String

body(包含在updateClusterDRS结构中)

集群DRS的启用状态

  • Enabled
  • Disabled

4.0.0

systemTags (可选)

List

body

系统标签

 

4.0.0

userTags (可选)

List

body

用户标签

 

4.0.0

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

UpdateClusterDRSAction action = new UpdateClusterDRSAction();
action.uuid = "ff067b9ad438337aa3d5beea6f504f00";
action.name = "Test";
action.description = "Test";
action.automationLevel = "Manual";
action.thresholdDuration = 10;
action.state = "Enabled";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateClusterDRSAction.Result res = action.call();

Python SDK

UpdateClusterDRSAction action = UpdateClusterDRSAction()
action.uuid = "ff067b9ad438337aa3d5beea6f504f00"
action.name = "Test"
action.description = "Test"
action.automationLevel = "Manual"
action.thresholdDuration = 10
action.state = "Enabled"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateClusterDRSAction.Result res = action.call()