向集群添加数据存储

POST/zstack/v1/clusters/{clusterUuid}/primary-storage/{primaryStorageUuid}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {},
  "systemTags": [],
  "userTags": []
}

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

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/clusters/06fa0d99fd9733409ea9dcb29e070fcf/primary-storage/e6df72f4eaaa324fb650cb7165bff218

参数列表

名字类型位置描述可选值起始版本
clusterUuidStringurl集群UUID 0.6
primaryStorageUuidStringurl数据存储UUID 0.6
systemTags (可选)Listbody系统标签 0.6
userTags (可选)Listbody用户标签 0.6

API返回

返回示例

{
  "inventory": {
    "name": "PS1",
    "url": "/Cloud_ps",
    "type": "LocalStorage",
    "state": "Enabled",
    "status": "Connected",
    "attachedClusterUuids": [
      "f0262ff5aeb54cd19e0a33bfaa61f5a4"
    ]
  }
}
名字类型描述起始版本
successboolean 4.7.0
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error0.6
inventoryPrimaryStorageInventory详情参考inventory0.6

error

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

inventory

名字类型描述起始版本
uuidString资源的UUID,唯一标示该资源0.6
zoneUuidString数据中心UUID0.6
nameString资源名称0.6
urlString 0.6
descriptionString资源的详细描述0.6
totalCapacityLong 0.6
availableCapacityLong 0.6
totalPhysicalCapacityLong 0.6
availablePhysicalCapacityLong 0.6
systemUsedCapacityLong 0.6
typeString 0.6
stateString 0.6
statusString 0.6
mountPathString 0.6
createDateTimestamp创建时间0.6
lastOpDateTimestamp最后一次修改时间0.6
attachedClusterUuidsList 0.6

SDK示例

Java SDK

AttachPrimaryStorageToClusterAction action = new AttachPrimaryStorageToClusterAction();
action.clusterUuid = "473e453a99844ea2a3b65aa637d33841";
action.primaryStorageUuid = "ffd9b14c1c3442f2bde3209cbe9cc195";
action.sessionId = "97c7848a46b44ba89f348f434b5f2288";
AttachPrimaryStorageToClusterAction.Result res = action.call();

Python SDK

AttachPrimaryStorageToClusterAction action = AttachPrimaryStorageToClusterAction()
action.clusterUuid = "cfae196b0d514f9fbc6ecd5360cb6ccf"
action.primaryStorageUuid = "c122244cd9ab48fa80f61e781e98bb03"
action.sessionId = "c5b2cc8440fc4a6299c5f96a37d38a7f"
AttachPrimaryStorageToClusterAction.Result res = action.call()