更新外部存储

PUT/zstack/v1/primary-storage/addon/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateExternalPrimaryStorage": {
    "config": "{\"pools\":[{\"name\":\"pool1\",\"aliasName\":\"pool-high\"}]}",
    "defaultProtocol": "Vhost",
    "name": "My Primary Storage",
    "description": "New description"
  },
  "systemTags": [],
  "userTags": []
}

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

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateExternalPrimaryStorage":{"config":"{\"pools\":[{\"name\":\"pool1\",\"aliasName\":\"pool-high\"}]}","defaultProtocol":"Vhost","name":"My Primary Storage","description":"New description"}}' \
http://localhost:8080/zstack/v1/primary-storage/addon/6275cc909e313b63a00acf1eea7a7e18/actions

参数列表

名字

类型

位置

描述

可选值

起始版本

config (可选)

String

body(包含在updateExternalPrimaryStorage结构中)

配置

 

5.0.0

defaultProtocol (可选)

String

body(包含在updateExternalPrimaryStorage结构中)

默认协议

  • Vhost
  • Scsi
  • Nvme
  • Curve
  • file

5.0.0

uuid

String

url

资源的UUID,唯一标示该资源

 

5.0.0

name (可选)

String

body(包含在updateExternalPrimaryStorage结构中)

资源名称

 

5.0.0

description (可选)

String

body(包含在updateExternalPrimaryStorage结构中)

资源的详细描述

 

5.0.0

url (可选)

String

body(包含在updateExternalPrimaryStorage结构中)

 

 

5.0.0

systemTags (可选)

List

body

系统标签

 

5.0.0

userTags (可选)

List

body

用户标签

 

5.0.0

API返回

返回示例

{
  "inventory": {
    "identity": "expon",
    "config": {
      "pools": [
        {
          "name": "pool1",
          "aliasName": "pool-high"
        },
        {
          "name": "pool2"
        }
      ]
    },
    "addonInfo": {
      "pools": [
        {
          "name": "pool1",
          "availableCapacity": 100,
          "totalCapacity": 200
        },
        {
          "name": "pool2",
          "availableCapacity": 100,
          "totalCapacity": 200
        }
      ]
    },
    "uuid": "f40dbde502013ea98a7fe9a30bac95a3",
    "url": "http://operator:*****@172.25.1.5:80",
    "totalCapacity": 107374182400,
    "availableCapacity": 53687091200,
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
名字类型描述起始版本
successboolean 5.0.0
inventoryExternalPrimaryStorageInventory详情参考inventory5.0.0
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error5.0.0

inventory

名字类型描述起始版本
identityString存储标识5.0.0
configString配置5.0.0
addonInfoString额外信息5.0.0
outputProtocolsList可输出协议5.0.0
defaultProtocolString默认协议5.0.0
uuidString资源的UUID,唯一标示该资源5.0.0
zoneUuidString数据中心UUID5.0.0
nameString资源名称5.0.0
urlString 5.0.0
descriptionString资源的详细描述5.0.0
totalCapacityLong 5.0.0
availableCapacityLong 5.0.0
totalPhysicalCapacityLong 5.0.0
availablePhysicalCapacityLong 5.0.0
systemUsedCapacityLong 5.0.0
typeString类型5.0.0
stateString 5.0.0
statusString 5.0.0
mountPathString 5.0.0
createDateTimestamp创建时间5.0.0
lastOpDateTimestamp最后一次修改时间5.0.0
attachedClusterUuidsList 5.0.0

error

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

SDK示例

Java SDK

UpdateExternalPrimaryStorageAction action = new UpdateExternalPrimaryStorageAction();
action.config = "{"pools":[{"name":"pool1","aliasName":"pool-high"}]}";
action.defaultProtocol = "Vhost";
action.uuid = "6275cc909e313b63a00acf1eea7a7e18";
action.name = "My Primary Storage";
action.description = "New description";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateExternalPrimaryStorageAction.Result res = action.call();

Python SDK

UpdateExternalPrimaryStorageAction action = UpdateExternalPrimaryStorageAction()
action.config = "{"pools":[{"name":"pool1","aliasName":"pool-high"}]}"
action.defaultProtocol = "Vhost"
action.uuid = "6275cc909e313b63a00acf1eea7a7e18"
action.name = "My Primary Storage"
action.description = "New description"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateExternalPrimaryStorageAction.Result res = action.call()