更新外部存储
Headers
Authorization: OAuth the-session-uuidBody
{
"updateExternalPrimaryStorage": {
"config": "{\"pools\":[{\"name\":\"pool1\",\"aliasName\":\"pool-high\"}]}",
"defaultProtocol": "Vhost",
"name": "My Primary Storage",
"description": "New description"
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示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(包含在 | 配置 |
| 5.0.0 |
defaultProtocol (可选) | String | body(包含在 | 默认协议 |
| 5.0.0 |
uuid | String | url | 资源的UUID,唯一标示该资源 |
| 5.0.0 |
name (可选) | String | body(包含在 | 资源名称 |
| 5.0.0 |
description (可选) | String | body(包含在 | 资源的详细描述 |
| 5.0.0 |
url (可选) | String | body(包含在 |
|
| 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"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| 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
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()