发现外部存储

POST/zstack/v1/primary-storage/addon/discover

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "url": "http://operator:password@172.25.1.5:80"
  },
  "systemTags": [],
  "userTags": []
}

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

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"url":"http://operator:password@172.25.1.5:80"}}' \
http://localhost:8080/zstack/v1/primary-storage/addon/discover

参数列表

名字类型位置描述可选值起始版本
urlStringbody(包含在params结构中)  5.0.0
identity (可选)Stringbody(包含在params结构中)存储标识 5.0.0
config (可选)Stringbody(包含在params结构中)配置 5.0.0
systemTags (可选)Listbody系统标签 5.0.0
userTags (可选)Listbody用户标签 5.0.0

API返回

返回示例

{
  "inventory": {
    "identity": "expon",
    "addonInfo": {
      "pools": [
        {
          "name": "pool1",
          "availableCapacity": 100,
          "totalCapacity": 200
        },
        {
          "name": "pool2",
          "availableCapacity": 100,
          "totalCapacity": 200
        }
      ]
    },
    "uuid": "2cb103e920c034b7a709b9cc7e0394b8",
    "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

DiscoverExternalPrimaryStorageAction action = new DiscoverExternalPrimaryStorageAction();
action.url = "http://operator:password@172.25.1.5:80";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DiscoverExternalPrimaryStorageAction.Result res = action.call();

Python SDK

DiscoverExternalPrimaryStorageAction action = DiscoverExternalPrimaryStorageAction()
action.url = "http://operator:password@172.25.1.5:80"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DiscoverExternalPrimaryStorageAction.Result res = action.call()