文档目录

发现外部存储(DiscoverExternalPrimaryStorage)

API请求

URLs
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": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示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
参数列表
名字 类型 位置 描述 可选值 起始版本
url String body(包含在params结构中) 5.0.0
identity (可选) String body(包含在params结构中) 存储标识 5.0.0
config (可选) String body(包含在params结构中) 配置 5.0.0
systemTags (可选) List body 系统标签 5.0.0
userTags (可选) List body 用户标签 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"
  }
}
名字 类型 描述 起始版本
success boolean 5.0.0
inventory ExternalPrimaryStorageInventory 详情参考inventory 5.0.0
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 5.0.0
#inventory
名字 类型 描述 起始版本
identity String 存储标识 5.0.0
config String 配置 5.0.0
addonInfo String 额外信息 5.0.0
outputProtocols List 可输出协议 5.0.0
defaultProtocol String 默认协议 5.0.0
uuid String 资源的UUID,唯一标示该资源 5.0.0
zoneUuid String 数据中心UUID 5.0.0
name String 资源名称 5.0.0
url String 5.0.0
description String 资源的详细描述 5.0.0
totalCapacity Long 5.0.0
availableCapacity Long 5.0.0
totalPhysicalCapacity Long 5.0.0
availablePhysicalCapacity Long 5.0.0
systemUsedCapacity Long 5.0.0
type String 类型 5.0.0
state String 5.0.0
status String 5.0.0
mountPath String 5.0.0
createDate Timestamp 创建时间 5.0.0
lastOpDate Timestamp 最后一次修改时间 5.0.0
attachedClusterUuids List 5.0.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.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()
开发手册 | ZStack ZSphere · ZVF | ZStack 资源中心