分布式存储相关接口
添加分布式存储(AddCephPrimaryStorage)
API请求
URLs
POST zstack/v1/primary-storage/cephHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"monUrls": [
"root:password@localhost/?monPort\u003d7777"
],
"rootVolumePoolName": "zs-images",
"dataVolumePoolName": "zs-data-volume",
"imageCachePoolName": "zs-image-cache",
"name": "My Ceph Primary Storage",
"zoneUuid": "d42197a462c34a44989bdf38d5aa2424"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"monUrls":["root:password@localhost/?monPort=7777"],"rootVolumePoolName":"zs-images","dataVolumePoolName":"zs-data-volume","imageCachePoolName":"zs-image-cache","name":"My Ceph Primary Storage","zoneUuid":"251a3dffccaf39fc8d190eedcf4395bf"}}' \
http://localhost:8080/zstack/v1/primary-storage/ceph参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| monUrls | List | body(包含在params结构中) | 分布式存储 mon 的地址列表 | 0.6 | |
| rootVolumePoolName (可选) | String | body(包含在params结构中) | 指定 Root Volume 可使用的 分布式存储 pool 名字 | 0.6 | |
| dataVolumePoolName (可选) | String | body(包含在params结构中) | 指定 Data Volume 可使用的分布式存储 pool 名字 | 0.6 | |
| imageCachePoolName (可选) | String | body(包含在params结构中) | 指定镜像缓存可使用的分布式存储 pool 名字 | 0.6 | |
| url | String | body(包含在params结构中) | 未使用 | 0.6 | |
| name | String | body(包含在params结构中) | 分布式存储的名称 | 0.6 | |
| description (可选) | String | body(包含在params结构中) | 分布式存储的详细描述 | 0.6 | |
| type (可选) | String | body(包含在params结构中) | 分布式存储的类型,此处为 Ceph | 0.6 | |
| zoneUuid | String | body(包含在params结构中) | 数据中心UUID | 0.6 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID。若指定,分布式存储会使用该字段值作为UUID。 | 0.6 | |
| systemTags (可选) | List | body | 系统标签 | 0.6 | |
| userTags (可选) | List | body | 用户标签 | 0.6 |
Note:
- ZStack ZSphere添加分布式存储时支持标识分布式存储的类型为xsky、sandstone、或open-source,SystemTags增加manufacturer选项。
- 选项格式为:
ceph::manufacturer::Platform - 例如:
ceph::manufacturer::xsky
- 选项格式为:
- ZStack ZSphere添加分布式存储时支持标识分布式存储的类型为xsky,且支持调用xsky类型分布式存储的SDK,SystemTags增加thirdPartyPlatform选项。
- 选项格式为:
ceph::thirdPartyPlatform::TOKEN - 例如:
ceph::thirdPartyPlatform::68b329da9893e34099c7d8ad5cb9c940
- 选项格式为:
API返回
返回示例
{
"inventory": {
"name": "Ceph-1",
"url": "not used",
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"attachedClusterUuids": [
"2d8583d86bd1472e8ec0e04e26ea273f"
]
}
}#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| zoneUuid | String | 数据中心UUID | 0.6 |
| name | String | 资源名称 | 0.6 |
| url | String | 0.6 | |
| description | String | 资源的详细描述 | 0.6 |
| totalCapacity | Long | 0.6 | |
| availableCapacity | Long | 0.6 | |
| totalPhysicalCapacity | Long | 0.6 | |
| availablePhysicalCapacity | Long | 0.6 | |
| systemUsedCapacity | Long | 0.6 | |
| type | String | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| mountPath | String | 0.6 | |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| attachedClusterUuids | List | 0.6 |
SDK示例
Java
SDK
AddCephPrimaryStorageAction action = new AddCephPrimaryStorageAction();
action.monUrls = asList("root:password@localhost/?monPort=7777");
action.rootVolumePoolName = "zs-images";
action.dataVolumePoolName = "zs-data-volume";
action.imageCachePoolName = "zs-image-cache";
action.name = "My Ceph Primary Storage";
action.zoneUuid = "88b49879acd34e11afa5bb3ea9164d5a";
action.sessionId = "33a01ee65ac64450940359dc3181f9b1";
AddCephPrimaryStorageAction.Result res = action.call();Python
SDK
AddCephPrimaryStorageAction action = AddCephPrimaryStorageAction()
action.monUrls = [root:password@localhost/?monPort=7777]
action.rootVolumePoolName = "zs-images"
action.dataVolumePoolName = "zs-data-volume"
action.imageCachePoolName = "zs-image-cache"
action.name = "My Ceph Primary Storage"
action.zoneUuid = "0f05052514554462b437f9cfa272f57f"
action.sessionId = "cb3d5ecb63634ca093ea223c55e6a30a"
AddCephPrimaryStorageAction.Result res = action.call()查询分布式存储(QueryCephPrimaryStorage)
API请求
URLs
GET zstack/v1/primary-storage/ceph
GET zstack/v1/primary-storage/ceph/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 9b17423dbac84ff4ace2e0d5f4d9e0d2" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph?q=uuid=c7b3cbd9ae3e44bb9536728191761cb3curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c0e6df86e0b34164b3e0471d7b0cdcb4" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/1ffb7b09c405477b95563abfcad506a0可查询字段
运行CLI命令行工具,输入QueryCephPrimaryStorage并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"name": "Ceph-1",
"url": "not used",
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"attachedClusterUuids": [
"1b70bb2e338f4a278b9efadda42ad26f"
]
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 0.6 |
| inventories | List | 详情参考inventories | 0.6 |
#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 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| zoneUuid | String | 数据中心UUID | 0.6 |
| name | String | 资源名称 | 0.6 |
| url | String | 0.6 | |
| description | String | 资源的详细描述 | 0.6 |
| totalCapacity | Long | 0.6 | |
| availableCapacity | Long | 0.6 | |
| totalPhysicalCapacity | Long | 0.6 | |
| availablePhysicalCapacity | Long | 0.6 | |
| systemUsedCapacity | Long | 0.6 | |
| type | String | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| mountPath | String | 0.6 | |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| attachedClusterUuids | List | 0.6 |
SDK示例
Java
SDK
QueryCephPrimaryStorageAction action = new QueryCephPrimaryStorageAction();
action.conditions = asList("uuid=d351d433b5974116a4c9649ef5b89e64");
action.sessionId = "172c3d6b977b4cbfbd401ace20ad0442";
QueryCephPrimaryStorageAction.Result res = action.call();Python
SDK
QueryCephPrimaryStorageAction action = QueryCephPrimaryStorageAction()
action.conditions = ["uuid=aa79df396a4943f8b9066c4d8057565d"]
action.sessionId = "0aca367c9e7946d29a63044684d5dd71"
QueryCephPrimaryStorageAction.Result res = action.call()为分布式存储添加监控节点(AddMonToCephPrimaryStorage)
API请求
URLs
POST zstack/v1/primary-storage/ceph/{uuid}/monsHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"monUrls": [
"10.0.1.3"
]
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"monUrls":["10.0.1.3"]}}' \
http://localhost:8080/zstack/v1/primary-storage/ceph/6496e4b29793368dbacf388d83446acc/mons参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 分布式存储的UUID | 0.6 | |
| monUrls | List | body(包含在params结构中) | mon 节点地址列表 | 0.6 | |
| systemTags (可选) | List | body | 系统标签 | 0.6 | |
| userTags (可选) | List | body | 用户标签 | 0.6 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
AddMonToCephPrimaryStorageAction action = new AddMonToCephPrimaryStorageAction();
action.uuid = "d0e3946e312a40c6af85da9163ac2519";
action.monUrls = asList("10.0.1.3");
action.sessionId = "6033eea9a2514c078c7af2a709ead405";
AddMonToCephPrimaryStorageAction.Result res = action.call();Python
SDK
AddMonToCephPrimaryStorageAction action = AddMonToCephPrimaryStorageAction()
action.uuid = "6b631b40a3fa434785a8b0bd49a3f199"
action.monUrls = [10.0.1.3]
action.sessionId = "c455c88362f84aa7acd07bd5f6d3a4d3"
AddMonToCephPrimaryStorageAction.Result res = action.call()从分布式存储删除监控节点(RemoveMonFromCephPrimaryStorage)
API请求
URLs
DELETE/v1/primary-storage/ceph/{uuid}/mons?monHostnames={monHostnames}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b57c6816e9b64ae881a356f9308bb6c7" \
-X DELETE http://localhost:8080/zstack/v1/primary-storage/ceph/31db2011f3944c85ae24a7ca607302e5/mons?monHostnames=10.0.1.2参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 分布式存储的UUID | 0.6 | |
| monHostnames | List | body | mon 节点名字列表 | 0.6 | |
| systemTags (可选) | List | body | 系统标签 | 0.6 | |
| userTags (可选) | List | body | 用户标签 | 0.6 |
API返回
返回示例
{
"inventory": {
"mons": [
{
"monAddr": "10.0.1.2",
"monUuid": "c72a3fc6e06649de811bf90ba8c9c574"
}
],
"name": "My Ceph Primary Storage",
"description": "Public Ceph Primary Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:21:07 PM",
"lastOpDate": "Jun 7, 2017 9:21:07 PM",
"attachedClusterUuids": [
"c0f667d99bfc41c1a133528a2089a9a7"
]
}
}#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| fsid | String | 0.6 | |
| rootVolumePoolName | String | 0.6 | |
| dataVolumePoolName | String | 0.6 | |
| imageCachePoolName | String | 0.6 | |
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| zoneUuid | String | 数据中心UUID | 0.6 |
| name | String | 资源名称 | 0.6 |
| url | String | 0.6 | |
| description | String | 资源的详细描述 | 0.6 |
| totalCapacity | Long | 0.6 | |
| availableCapacity | Long | 0.6 | |
| totalPhysicalCapacity | Long | 0.6 | |
| availablePhysicalCapacity | Long | 0.6 | |
| systemUsedCapacity | Long | 0.6 | |
| type | String | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| mountPath | String | 0.6 | |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| attachedClusterUuids | List | 0.6 | |
| mons | List | 详情参考mons | 0.6 |
#mons
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| hostname | String | 0.6 | |
| monPort | Integer | 0.6 | |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| primaryStorageUuid | String | 数据存储UUID | 0.6 |
| monAddr | String | 0.6 | |
| sshUsername | String | 0.6 | |
| sshPassword | String | 0.6 | |
| sshPort | Integer | 0.6 | |
| status | String | 0.6 | |
| monUuid | String | 0.6 |
SDK示例
Java
SDK
RemoveMonFromCephPrimaryStorageAction action = new RemoveMonFromCephPrimaryStorageAction();
action.uuid = "05aa4826fdbd4021b72e4d9a5db67bbc";
action.monHostnames = asList("10.0.1.2");
action.sessionId = "2412a720a3bb4992887979298217b300";
RemoveMonFromCephPrimaryStorageAction.Result res = action.call();Python
SDK
RemoveMonFromCephPrimaryStorageAction action = RemoveMonFromCephPrimaryStorageAction()
action.uuid = "fb3dca5509154ca48698f374794f4d93"
action.monHostnames = [10.0.1.2]
action.sessionId = "9eb682deaa894cea80e1608056492948"
RemoveMonFromCephPrimaryStorageAction.Result res = action.call()更新分布式存储监控节点(UpdateCephPrimaryStorageMon)
API请求
URLs
PUT zstack/v1/primary-storage/ceph/mons/{monUuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateCephPrimaryStorageMon": {
"hostname": "10.0.1.4"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateCephPrimaryStorageMon":{"hostname":"10.0.1.4"}}' \
http://localhost:8080/zstack/v1/primary-storage/ceph/mons/cda8b731b2e23b8eb1081dec0f7a0a60/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| monUuid | String | url | 监控节点UUID | 0.6 | |
| hostname (可选) | String | body(包含在updateCephPrimaryStorageMon结构中) | 监控节点新主机IP地址 | 0.6 | |
| sshUsername (可选) | String | body(包含在updateCephPrimaryStorageMon结构中) | 监控节点主机 ssh 用户名 | 0.6 | |
| sshPassword (可选) | String | body(包含在updateCephPrimaryStorageMon结构中) | 监控节点主机 ssh 用户密码 | 0.6 | |
| sshPort (可选) | Integer | body(包含在updateCephPrimaryStorageMon结构中) | 监控节点主机 ssh 端口 | 0.6 | |
| monPort (可选) | Integer | body(包含在updateCephPrimaryStorageMon结构中) | mon的新端口 | 0.6 | |
| systemTags (可选) | List | body | 系统标签 | 0.6 | |
| userTags (可选) | List | body | 用户标签 | 0.6 |
API返回
返回示例
{
"inventory": {
"mons": [
{
"monAddr": "10.0.1.4",
"monUuid": "d557e48870b04ef699509d2998084bdb"
}
],
"name": "My Ceph Primary Storage",
"description": "Public Ceph Primary Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:21:22 PM",
"lastOpDate": "Jun 7, 2017 9:21:22 PM",
"attachedClusterUuids": [
"3fa1f7c2bbb544e1a04ba9f9da935abe"
]
}
}#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| fsid | String | 0.6 | |
| rootVolumePoolName | String | 0.6 | |
| dataVolumePoolName | String | 0.6 | |
| imageCachePoolName | String | 0.6 | |
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| zoneUuid | String | 数据中心UUID | 0.6 |
| name | String | 资源名称 | 0.6 |
| url | String | 0.6 | |
| description | String | 资源的详细描述 | 0.6 |
| totalCapacity | Long | 0.6 | |
| availableCapacity | Long | 0.6 | |
| totalPhysicalCapacity | Long | 0.6 | |
| availablePhysicalCapacity | Long | 0.6 | |
| systemUsedCapacity | Long | 0.6 | |
| type | String | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| mountPath | String | 0.6 | |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| attachedClusterUuids | List | 0.6 | |
| mons | List | 详情参考mons | 0.6 |
#mons
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| hostname | String | 0.6 | |
| monPort | Integer | 0.6 | |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| primaryStorageUuid | String | 数据存储UUID | 0.6 |
| monAddr | String | 0.6 | |
| sshUsername | String | 0.6 | |
| sshPassword | String | 0.6 | |
| sshPort | Integer | 0.6 | |
| status | String | 0.6 | |
| monUuid | String | 0.6 |
SDK示例
Java
SDK
UpdateCephPrimaryStorageMonAction action = new UpdateCephPrimaryStorageMonAction();
action.monUuid = "3341eaef160045d6b6fd085a22a3c69f";
action.hostname = "10.0.1.4";
action.sessionId = "359aceecda5e478e81d4eaea9e86bca8";
UpdateCephPrimaryStorageMonAction.Result res = action.call();
Python
SDK
UpdateCephPrimaryStorageMonAction action = UpdateCephPrimaryStorageMonAction()
action.monUuid = "70bc5237403848f6b5b6a60079c3ab91"
action.hostname = "10.0.1.4"
action.sessionId = "b1737cdb77c4420ba72aab66c4438521"
UpdateCephPrimaryStorageMonAction.Result res = action.call()添加分布式存储存储池(AddCephPrimaryStoragePool)
API请求
URLs
POST zstack/v1/primary-storage/ceph/{primaryStorageUuid}/poolsHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"poolName": "highPerformance",
"aliasName": "alias pool name",
"description": "for high performance data volumes",
"isCreate": true
"type": "ROOT
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"poolName":"highPerformance","aliasName":"alias pool name","description":"for high performance data volumes","isCreate":true,"type":"Root"}}' http://localhost:8080/zstack/v1/primary-storage/ceph/fe5adfa6042b33cd8ee7b5bcd994245f/pools参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| primaryStorageUuid | String | url | 数据存储UUID | 0.6 | |
| poolName | String | body(包含在params结构中) | 0.6 | ||
| aliasName (可选) | String | body(包含在params结构中) | 0.6 | ||
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 0.6 | |
| isCreate (可选) | boolean | body(包含在params结构中) | 0.6 | ||
| type | String | body(包含在params结构中) | 存储池类型 | 3.1.1 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 0.6 | ||
| systemTags (可选) | List | body | 0.6 | ||
| userTags (可选) | List | body | 0.6 |
API返回
返回示例
{
"inventory": {
"uuid": "97ac9dc5fc223f80918747a8a398478b",
"primaryStorageUuid": "82b127a3f6cc3ec7bd7ff01069310099",
"poolName": "pool name",
"aliasName": "alias name",
"description": "description",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"type": "Data"
}
}#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| primaryStorageUuid | String | 数据存储UUID | 0.6 |
| poolName | String | 0.6 | |
| aliasName | String | 0.6 | |
| description | String | 资源的详细描述 | 0.6 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| type | String | 0.6 | |
|
availableCapacity |
Long | 2.3.2 | |
| usedCapacity | Long | 2.3.2 | |
| replicatedSize | Integer | 2.3.2 |
SDK示例
Java
SDK
AddCephPrimaryStoragePoolAction action = new AddCephPrimaryStoragePoolAction();
action.primaryStorageUuid = "fe5adfa6042b33cd8ee7b5bcd994245f";
action.poolName = "highPerformance";
action.aliasName = "alias pool name";
action.description = "for high performance data volumes";
action.isCreate = true;
action.type = "Root"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddCephPrimaryStoragePoolAction.Result res = action.call();Python
SDK
AddCephPrimaryStoragePoolAction action = AddCephPrimaryStoragePoolAction()
action.primaryStorageUuid = "fe5adfa6042b33cd8ee7b5bcd994245f"
action.poolName = "highPerformance"
action.aliasName = "alias pool name"
action.type = "Root"
action.description = "for high performance data volumes"
action.isCreate = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddCephPrimaryStoragePoolAction.Result res = action.call()删除分布式存储存储池(DeleteCephPrimaryStoragePool)
API请求
URLs
DELETE zstack/v1/primary-storage/ceph/pools/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/primary-storage/ceph/pools/5d9ee6f791d33de3a3aff68f7a746282?参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 0.6 | |
| systemTags (可选) | List | body | 0.6 | ||
| userTags (可选) | List | body | 0.6 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
DeleteCephPrimaryStoragePoolAction action = new DeleteCephPrimaryStoragePoolAction();
action.uuid = "5d9ee6f791d33de3a3aff68f7a746282";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteCephPrimaryStoragePoolAction.Result res = action.call();Python
SDK
DeleteCephPrimaryStoragePoolAction action = DeleteCephPrimaryStoragePoolAction()
action.uuid = "5d9ee6f791d33de3a3aff68f7a746282"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteCephPrimaryStoragePoolAction.Result res = action.call()查询分布式存储存储池(QueryCephPrimaryStoragePool)
API请求
URLs
GET zstack/v1/primary-storage/ceph/pools
GET zstack/v1/primary-storage/ceph/pools/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/pools?q=name=highPerformancecurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/pools/d4e5d23825ff3004856e1720eff59131可查询字段
运行CLI命令行工具,输入QueryCephPrimaryStoragePool并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"primaryStorageUuid": "d0e638ede3263a9080c41ce860106043",
"poolName": "test pool",
"aliasName": "alias test pool",
"description": "high performance",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"type": "Data"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 0.6 |
| inventories | List | 详情参考inventories | 0.6 |
#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 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| primaryStorageUuid | String | 数据存储UUID | 0.6 |
| poolName | String | 0.6 | |
| aliasName | String | 0.6 | |
| description | String | 资源的详细描述 | 0.6 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| type | String | 0.6 | |
| usedCapacity | Long | 2.3.2 | |
| replicatedSize | Integer | 2.3.2 | |
|
availableCapacity |
Long | 2.3.2 |
SDK示例
Java
SDK
QueryCephPrimaryStoragePoolAction action = new QueryCephPrimaryStoragePoolAction();
action.conditions = asList("name=highPerformance");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryCephPrimaryStoragePoolAction.Result res = action.call();Python
SDK
QueryCephPrimaryStoragePoolAction action = QueryCephPrimaryStoragePoolAction()
action.conditions = ["name=highPerformance"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryCephPrimaryStoragePoolAction.Result res = action.call()更新分布式存储存储池(UpdateCephPrimaryStoragePool)
API请求
URLs
PUT zstack/v1/primary-storage/ceph/pools/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateCephPrimaryStoragePool": {
"aliasName": "alias",
"description": "description"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateCephPrimaryStoragePool":{"aliasName":"alias","description":"description"}}' \
http://localhost:8080/zstack/v1/primary-storage/ceph/pools/8b2d94a2a12332a7ace559238644472c/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 0.6 | |
| aliasName (可选) | String | body(包含在updateCephPrimaryStoragePool结构中) | 0.6 | ||
| description (可选) | String | body(包含在updateCephPrimaryStoragePool结构中) | 资源的详细描述 | 0.6 | |
| systemTags (可选) | List | body | 0.6 | ||
| userTags (可选) | List | body | 0.6 |
API返回
返回示例
{
"inventory": {
"uuid": "7f0e174e86e739d695b0e5b9674e3638",
"primaryStorageUuid": "6b247ebee1e4326998f10e03a5f8c230",
"poolName": "pool name",
"aliasName": "alias name",
"description": "description",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"type": "Data"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 0.6 |
| inventory | CephPrimaryStoragePoolInventory | 详情参考inventory | 0.6 |
#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| primaryStorageUuid | String | 数据存储UUID | 0.6 |
| poolName | String | 0.6 | |
| aliasName | String | 0.6 | |
| description | String | 资源的详细描述 | 0.6 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| type | String | 0.6 | |
| usedCapacity | Long | 2.3.2 | |
| replicatedSize | Integer | 2.3.2 | |
|
availableCapacity |
Long | 2.3.2 |
SDK示例
Java
SDK
UpdateCephPrimaryStoragePoolAction action = new UpdateCephPrimaryStoragePoolAction();
action.uuid = "8b2d94a2a12332a7ace559238644472c";
action.aliasName = "alias";
action.description = "description";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateCephPrimaryStoragePoolAction.Result res = action.call();Python
SDK
UpdateCephPrimaryStoragePoolAction action = UpdateCephPrimaryStoragePoolAction()
action.uuid = "8b2d94a2a12332a7ace559238644472c"
action.aliasName = "alias"
action.description = "description"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateCephPrimaryStoragePoolAction.Result res = action.call()查询分布式存储OSD组(QueryCephOsdGroup)
API请求
URLs
GET zstack/v1/primary-storage/ceph/osdgroups
GET zstack/v1/primary-storage/ceph/osdgroups/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/osdgroups\
q=uuid=b2c53eee77bc3bfea5374d417babff07curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/osdgroups/9ee0973b0e79393e9f7d03a6e3a6f645可查询字段
运行CLI命令行工具,输入QueryCephOsdGroup并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"osds": "osd.1",
"availableCapacity": 0.0,
"availablePhysicalCapacity": 1024.0,
"totalPhysicalCapacity": 1024.0,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 4.5.0 | |
| inventories | List | 详情参考inventories | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| primaryStorageUuid | String | 数据存储UUID | 4.5.0 |
| osds | String | 4.5.0 | |
| availableCapacity | long | 4.5.0 | |
| availablePhysicalCapacity | long | 4.5.0 | |
| totalPhysicalCapacity | long | 4.5.0 | |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
SDK示例
Java
SDK
QueryCephOsdGroupAction action = new QueryCephOsdGroupAction();
action.conditions = asList("uuid=3e479fc0962c3561a854d868fce5ab3e");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryCephOsdGroupAction.Result res = action.call();Python
SDK
QueryCephOsdGroupAction action = QueryCephOsdGroupAction()
action.conditions = ["uuid=45906504e89335809e54a79897eb1357"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryCephOsdGroupAction.Result res = action.call()创建块存储卷(CreateBlockVolume)
API请求
URLs
POST zstack/v1/block-volumesHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "example",
"description": "block volume test"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中
systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"example","description":"block volume test"}}' \
http://localhost:8080/zstack/v1/block-volumes参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在params结构中) |
资源名称 | 4.7.11 | |
| description (可选) | String | body(包含在params结构中) |
资源的详细描述 | 4.7.11 | |
| size | Long | body(包含在params结构中) |
容量 | 4.7.11 | |
| primaryStorageUuid | String | body(包含在params结构中) |
数据存储UUID | 4.7.11 | |
| accessPathId | Integer | body(包含在params结构中) |
访问路径id | 4.7.11 | |
| accessPathIqn | String | body(包含在params结构中) |
访问路径iqn | 4.7.11 | |
| burstTotalBw (可选) | Long | body(包含在params结构中) |
突发带宽 | 4.7.11 | |
| burstTotalIops (可选) | Long | body(包含在params结构中) |
突发IOPS | 4.7.11 | |
| maxTotalBw (可选) | Long | body(包含在params结构中) |
最大带宽 | 4.7.11 | |
| maxTotalIops (可选) | Long | body(包含在params结构中) |
最大IOPS | 4.7.11 | |
| resourceUuid (可选) | String | body(包含在params结构中) |
资源UUID | 4.7.11 | |
| tagUuids (可选) | List | body(包含在params结构中) |
标签UUID列表 | 4.7.11 | |
| systemTags (可选) | List | body | 系统标签 | 4.7.11 | |
| userTags (可选) | List | body | 用户标签 | 4.7.11 |
API返回
返回示例
{
"inventory": {}
}#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| iscsiPath | String | 4.7.11 | |
| vendor | String | 4.7.11 | |
| uuid | String | 资源的UUID,唯一标示该资源 | 4.7.11 |
| name | String | 资源名称 | 4.7.11 |
| description | String | 资源的详细描述 | 4.7.11 |
| primaryStorageUuid | String | 数据存储UUID | 4.7.11 |
| vmInstanceUuid | String | 虚拟机UUID | 4.7.11 |
| diskOfferingUuid | String | 硬盘规格UUID | 4.7.11 |
| rootImageUuid | String | 4.7.11 | |
| installPath | String | 4.7.11 | |
| type | String | 4.7.11 | |
| format | String | 4.7.11 | |
| size | Long | 4.7.11 | |
| actualSize | Long | 4.7.11 | |
| deviceId | Integer | 4.7.11 | |
| state | String | 4.7.11 | |
| status | String | 4.7.11 | |
| createDate | Timestamp | 创建时间 | 4.7.11 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.7.11 |
| isShareable | Boolean | 4.7.11 | |
| volumeQos | String | 4.7.11 | |
| lastDetachDate | Timestamp | 4.7.11 | |
| lastVmInstanceUuid | String | 4.7.11 |
#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
CreateBlockVolumeAction action = new CreateBlockVolumeAction();
action.name = "example";
action.description = "block volume test";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBlockVolumeAction.Result res = action.call();Python
SDK
CreateBlockVolumeAction action = CreateBlockVolumeAction()
action.name = "example"
action.description = "block volume test"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateBlockVolumeAction.Result res = action.call()获取访问路径列表(GetAccessPath)
API请求
URLs
GET zstack/v1/block-volumes/access/pathHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/block-volumes/access/path?primaryStorageUuid=56963d0046b330839488e795b5109e44参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| systemTags (可选) | List | query | 系统标签 | 4.7.11 | |
| userTags (可选) | List | query | 用户标签 | 4.7.11 | |
| primaryStorageUuid | String | query | 数据存储UUID | 4.7.11 |
API返回
返回示例
{
"pathInfos": [
{
"accessPathId": 1,
"accessPathIqn": "iqn",
"targetCount": 1
}
]
}#pathInfos
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 4.7.11 |
| accessPathId | String | 访问路径id | 4.7.11 |
| accessPathIqn | String | 访问路径iqn | 4.7.11 |
| targetCount | Integer | 关联目标数量 | 4.7.11 |
| gatewayIps | List | 网关ip | 4.7.11 |
#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
GetAccessPathAction action = new GetAccessPathAction();
action.primaryStorageUuid = "56963d0046b330839488e795b5109e44";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetAccessPathAction.Result res = action.call();Python
SDK
GetAccessPathAction action = GetAccessPathAction()
action.primaryStorageUuid = "56963d0046b330839488e795b5109e44"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetAccessPathAction.Result res = action.call()查询块存储卷(QueryBlockVolume)
API请求
URLs
GET zstack/v1/block-volumes
GET zstack/v1/block-volumes/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/block-volumes?q=uuid=xxx&q=name=xxxcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/block-volumes/188cd27b3e053a16977a0f2ad1b3bd91可查询字段
运行CLI命令行工具,输入QueryBlockVolume并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
QueryBlockVolumeAction action = new QueryBlockVolumeAction();
action.conditions = asList("uuid=xxx","name=xxx");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryBlockVolumeAction.Result res = action.call();Python
SDK
QueryBlockVolumeAction action = QueryBlockVolumeAction()
action.conditions = ["uuid=xxx","name=xxx"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryBlockVolumeAction.Result res = action.call()查询xsky类型块存储卷(QueryXskyBlockVolume)
API请求
URLs
GET zstack/v1/xksy/block-volumes
GET zstack/v1/xsky/block-volumes/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/xksy/block-volumes?q=uuid=xxx&q=name=xxxcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/xsky/block-volumes/54e1b033658b3aa28536d0064c07c536可查询字段
运行CLI命令行工具,输入QueryXskyBlockVolume并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
QueryXskyBlockVolumeAction action = new QueryXskyBlockVolumeAction();
action.conditions = asList("uuid=xxx","name=xxx");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryXskyBlockVolumeAction.Result res = action.call();Python
SDK
QueryXskyBlockVolumeAction action = QueryXskyBlockVolumeAction()
action.conditions = ["uuid=xxx","name=xxx"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryXskyBlockVolumeAction.Result res = action.call()更新块存储卷(UpdateBlockVolume)
API请求
URLs
PUT zstack/v1/block-volumes/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateBlockVolume": {
"name": "example"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中
systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateBlockVolume":{"name":"example"}}' \
http://localhost:8080/zstack/v1/block-volumes/09c2f52fe02030019306d55b1ac7e849/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.7.11 | |
| name (可选) | String | body(包含在updateBlockVolume结构中) |
资源名称 | 4.7.11 | |
| description (可选) | String | body(包含在updateBlockVolume结构中) |
资源的详细描述 | 4.7.11 | |
| burstTotalBw (可选) | Long | body(包含在updateBlockVolume结构中) |
突发带宽 | 4.7.11 | |
| burstTotalIops (可选) | Long | body(包含在updateBlockVolume结构中) |
突发IOPS | 4.7.11 | |
| maxTotalBw (可选) | Long | body(包含在updateBlockVolume结构中) |
最大带宽 | 4.7.11 | |
| maxTotalIops (可选) | Long | body(包含在updateBlockVolume结构中) |
最大IOPS | 4.7.11 | |
| systemTags (可选) | List | body | 系统标签 | 4.7.11 | |
| userTags (可选) | List | body | 用户标签 | 4.7.11 |
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
UpdateBlockVolumeAction action = new UpdateBlockVolumeAction();
action.uuid = "09c2f52fe02030019306d55b1ac7e849";
action.name = "example";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateBlockVolumeAction.Result res = action.call();Python
SDK
UpdateBlockVolumeAction action = UpdateBlockVolumeAction()
action.uuid = "09c2f52fe02030019306d55b1ac7e849"
action.name = "example"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateBlockVolumeAction.Result res = action.call()更新xsky类型的块存储卷(UpdateXskyBlockVolume)
API请求
URLs
PUT zstack/v1/xsky/block-volumes/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateXskyBlockVolume": {
"name": "example"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中
systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateXskyBlockVolume":{"name":"example"}}' \
http://localhost:8080/zstack/v1/xsky/block-volumes/eeb07fe1a24833959f75c38b9c7e4132/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.7.11 | |
| name (可选) | String | body(包含在updateXskyBlockVolume结构中) |
资源名称 | 4.7.11 | |
| description (可选) | String | body(包含在updateXskyBlockVolume结构中) |
资源的详细描述 | 4.7.11 | |
| burstTotalBw (可选) | Long | body(包含在updateXskyBlockVolume结构中) |
4.7.11 | ||
| burstTotalIops (可选) | Long | body(包含在updateXskyBlockVolume结构中) |
4.7.11 | ||
| maxTotalBw (可选) | Long | body(包含在updateXskyBlockVolume结构中) |
4.7.11 | ||
| maxTotalIops (可选) | Long | body(包含在updateXskyBlockVolume结构中) |
4.7.11 | ||
| systemTags (可选) | List | body | 系统标签 | 4.7.11 | |
| userTags (可选) | List | body | 用户标签 | 4.7.11 |
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
UpdateXskyBlockVolumeAction action = new UpdateXskyBlockVolumeAction();
action.uuid = "eeb07fe1a24833959f75c38b9c7e4132";
action.name = "example";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateXskyBlockVolumeAction.Result res = action.call();Python
SDK
UpdateXskyBlockVolumeAction action = UpdateXskyBlockVolumeAction()
action.uuid = "eeb07fe1a24833959f75c38b9c7e4132"
action.name = "example"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateXskyBlockVolumeAction.Result res = action.call()检查ceph健康状态(CheckCephHealthStatus)
API请求
URLs
POST zstack/v1/zops/check-ceph-healthHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {},
"systemTags": [],
"userTags": []
}Note: 上述示例中
systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/zops/check-ceph-health参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| systemTags (可选) | List | body | 系统标签 | 4.10.10 | |
| userTags (可选) | List | body | 用户标签 | 4.10.10 |
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
CheckCephHealthStatusAction action = new CheckCephHealthStatusAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CheckCephHealthStatusAction.Result res = action.call();Python
SDK
CheckCephHealthStatusAction action = CheckCephHealthStatusAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CheckCephHealthStatusAction.Result res = action.call()查询expon类型块存储卷(QueryExponBlockVolume)
API请求
URLs
GET zstack/v1/expon/block-volumes
GET zstack/v1/expon/block-volumes/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/expon/block-volumes?q=uuid=xxx&q=name=xxxcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/expon/block-volumes/57dcd9124665304191c221331ee95e6b可查询字段
运行CLI命令行工具,输入QueryExponBlockVolume并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java SDK
QueryExponBlockVolumeAction action = new QueryExponBlockVolumeAction();
action.conditions = asList("uuid=xxx","name=xxx");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryExponBlockVolumeAction.Result res = action.call();Python SDK
action = QueryExponBlockVolumeAction()
action.conditions = ["uuid=xxx","name=xxx"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()检查环境中的Ceph插件(CheckCephPlugin)
API请求
URLs
PUT zstack/v1/ceph-plugin/checkHeaders
Authorization: OAuth the-session-uuidBody
{
"checkCephPlugin": {
"managementNode": true
},
"systemTags": [],
"userTags": []
}Note: 上述示例中
systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"checkCephPlugin":{"managementNode":true}}' \
http://localhost:8080/zstack/v1/ceph-plugin/check参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| managementNode (可选) | boolean | body(包含在checkCephPlugin结构中) |
是否对所有管理节点进行检查 | 4.10.7 | |
| hostUuidList (可选) | List | body(包含在checkCephPlugin结构中) |
增加检查 host 的信息列表 | 4.10.7 | |
| ipList (可选) | List | body(包含在checkCephPlugin结构中) |
增加检查指定 IP 对应的主机的信息列表 | 4.10.7 | |
| externalHosts (可选) | List | body(包含在checkCephPlugin结构中) |
指定用于检查的外部主机 SSH 连接参数列表 | 4.10.20 | |
| systemTags (可选) | List | body | 系统标签 | 4.10.7 | |
| userTags (可选) | List | body | 用户标签 | 4.10.7 |
SDK示例
Java SDK
CheckCephPluginAction action = new CheckCephPluginAction();
action.managementNode = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CheckCephPluginAction.Result res = action.call();Python SDK
action = CheckCephPluginAction()
action.managementNode = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()