Shared Block主存储相关接口
添加Shared Block主存储(AddSharedBlockGroupPrimaryStorage)
API请求
URLs
POST zstack/v1/primary-storage/sharedblockgroupHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"diskUuids": [
"1b5682b663b937a59adb9e318cab6b05"
],
"name": "shared-block-group-1",
"type": "SharedBlock",
"zoneUuid": "eee8b39ad50b300c8935e554a967691b"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"diskUuids":["1b5682b663b937a59adb9e318cab6b05"],"name":"shared-block-group-1","type":"SharedBlock","zoneUuid":"eee8b39ad50b300c8935e554a967691b"}}' http://localhost:8080/zstack/v1/primary-storage/sharedblockgroup参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| diskUuids | List | body(包含在params结构中) | 磁盘唯一表示(例如UUID, WWN, WWID) | 2.3.2 | |
| name | String | body(包含在params结构中) | 资源名称 | 2.3.2 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 2.3.2 | |
| type (可选) | String | body(包含在params结构中) | 主存储类型,此处为 SharedBlock | 2.3.2 | |
| url | String | body(包含在params结构中) | 未使用 | 2.3.2 | |
| zoneUuid | String | body(包含在params结构中) | 区域UUID | 2.3.2 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 2.3.2 | ||
| systemTags (可选) | List | body | 2.3.2 | ||
| userTags (可选) | List | body | 2.3.2 |
Note:
- ZStack Cloud添加Shared
Block主存储时支持指定云盘默认置备方式,SystemTags增加primaryStorageVolumeProvisioningStrategy选项。
- 选项格式为:
primaryStorageVolumeProvisioningStrategy::ThinProvisioning, primaryStorageVolumeProvisioningStrategy::ThickProvisioning - 例如:
primaryStorageVolumeProvisioningStrategy::ThinProvisioning, primaryStorageVolumeProvisioningStrategy::ThickProvisioning
- 选项格式为:
API返回
返回示例
{
"inventory": {
"name": "PS1",
"url": "/Cloud_ps",
"type": "LocalStorage",
"state": "Enabled",
"status": "Connected",
"attachedClusterUuids": [
"c6e9684e8bb93a9192c946dcd0564b39"
]
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.3.2 |
| inventory | PrimaryStorageInventory | 详情参考inventory | 2.3.2 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.3.2 |
| description | String | 错误的概要描述 | 2.3.2 |
| details | String | 错误的详细信息 | 2.3.2 |
| elaboration | String | 保留字段,默认为null | 2.3.2 |
| opaque | LinkedHashMap | 保留字段,默认为null | 2.3.2 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.3.2 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3.2 |
| zoneUuid | String | 区域UUID | 2.3.2 |
| name | String | 资源名称 | 2.3.2 |
| url | String | 2.3.2 | |
| description | String | 资源的详细描述 | 2.3.2 |
| totalCapacity | Long | 2.3.2 | |
| availableCapacity | Long | 2.3.2 | |
| totalPhysicalCapacity | Long | 2.3.2 | |
| availablePhysicalCapacity | Long | 2.3.2 | |
| systemUsedCapacity | Long | 2.3.2 | |
| type | String | 2.3.2 | |
| state | String | 2.3.2 | |
| status | String | 2.3.2 | |
| mountPath | String | 2.3.2 | |
| createDate | Timestamp | 创建时间 | 2.3.2 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3.2 |
| attachedClusterUuids | List | 2.3.2 |
SDK示例
Java
SDK
AddSharedBlockGroupPrimaryStorageAction action = new AddSharedBlockGroupPrimaryStorageAction();
action.diskUuids = asList("1b5682b663b937a59adb9e318cab6b05");
action.name = "shared-block-group-1";
action.type = "SharedBlock";
action.zoneUuid = "eee8b39ad50b300c8935e554a967691b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSharedBlockGroupPrimaryStorageAction.Result res = action.call();Python
SDK
AddSharedBlockGroupPrimaryStorageAction action = AddSharedBlockGroupPrimaryStorageAction()
action.diskUuids = [1b5682b663b937a59adb9e318cab6b05]
action.name = "shared-block-group-1"
action.type = "SharedBlock"
action.zoneUuid = "eee8b39ad50b300c8935e554a967691b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSharedBlockGroupPrimaryStorageAction.Result res = action.call()查询连接状态(QuerySharedBlockGroupPrimaryStorageHostRef)
查询SharedBlock主存储物理机连接状态。
API请求
URLs
GET zstack/v1/sharedblock-group/host-refs
GET zstack/v1/sharedblock-group/{primaryStorageUuid}/host-refsHeaders
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/sharedblock-group/host-refscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sharedblock-group/{primaryStorageUuid}/host-refs可查询字段
运行CLI命令行工具,输入QuerySharedBlock并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"primaryStorageUuid": "a9e96e98cc2c3a3baa23e31503fc93e6",
"hostUuid": "7c5510f255663a3cbfd53367c0172507",
"hostId": 100.0,
"status": "Connected",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.3.2 |
| inventories | List | 详情参考inventories | 2.3.2 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.3.2 |
| description | String | 错误的概要描述 | 2.3.2 |
| details | String | 错误的详细信息 | 2.3.2 |
| elaboration | String | 保留字段,默认为null | 2.3.2 |
| opaque | LinkedHashMap | 保留字段,默认为null | 2.3.2 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.3.2 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| primaryStorageUuid | String | 主存储UUID | 2.3.2 |
| hostUuid | String | 物理机UUID | 2.3.2 |
| hostId | Integer | 物理机ID | 2.3.2 |
| createDate | Timestamp | 创建时间 | 2.3.2 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3.2 |
| status | PrimaryStorageHostStatus | 详情参考status | 2.3.2 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
SDK示例
Java
SDK
QuerySharedBlockGroupPrimaryStorageHostRefAction action = new QuerySharedBlockGroupPrimaryStorageHostRefAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySharedBlockGroupPrimaryStorageHostRefAction.Result res = action.call();Python
SDK
QuerySharedBlockGroupPrimaryStorageHostRefAction action = QuerySharedBlockGroupPrimaryStorageHostRefAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySharedBlockGroupPrimaryStorageHostRefAction.Result res = action.call()查询Shared Block主存储(QuerySharedBlockGroupPrimaryStorage)
API请求
URLs
GET zstack/v1/primary-storage/sharedblockgroup
GET zstack/v1/primary-storage/sharedblockgroup/{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/sharedblockgroupcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/sharedblockgroup/ab5776cffa893955a533f7e89cdaf025可查询字段
运行CLI命令行工具,输入QuerySharedBlock并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"sharedBlocks": [
{
"uuid": "2bf68818dc2c3ffbb9c9f283c8a1f524",
"sharedBlockGroupUuid": "23ef265b88143074b88ad450afe5cbac",
"type": "LvmLogicalVolumeBasic",
"diskUuid": "b4d9459d02533fdeb4dee8b8bf943bed",
"name": "test shared block",
"description": "description",
"state": "Enabled",
"status": "Connected",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"sharedBlockGroupType": "LvmVolumeGroupBasic",
"uuid": "23ef265b88143074b88ad450afe5cbac",
"name": "shared block group primary storage",
"description": "shared block group primary storage description",
"availableCapacity": 1.073741824E9,
"availablePhysicalCapacity": 1.073741824E9,
"type": "SharedBlock",
"state": "Enabled",
"status": "Connected",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.3.2 |
| inventories | List | 详情参考inventories | 2.3.2 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.3.2 |
| description | String | 错误的概要描述 | 2.3.2 |
| details | String | 错误的详细信息 | 2.3.2 |
| elaboration | String | 保留字段,默认为null | 2.3.2 |
| opaque | LinkedHashMap | 保留字段,默认为null | 2.3.2 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.3.2 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3.2 |
| zoneUuid | String | 区域UUID | 2.3.2 |
| name | String | 资源名称 | 2.3.2 |
| url | String | 未使用 | 2.3.2 |
| description | String | 资源的详细描述 | 2.3.2 |
| totalCapacity | Long | 总空间 | 2.3.2 |
| availableCapacity | Long | 可用空间 | 2.3.2 |
| totalPhysicalCapacity | Long | 总物理空间 | 2.3.2 |
| availablePhysicalCapacity | Long | 物理可用空间 | 2.3.2 |
| systemUsedCapacity | Long | 系统使用空间 | 2.3.2 |
| type | String | 主存储类型 | 2.3.2 |
| state | String | 启用状态 | 2.3.2 |
| status | String | 连接状态 | 2.3.2 |
| mountPath | String | 未使用 | 2.3.2 |
| createDate | Timestamp | 创建时间 | 2.3.2 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3.2 |
| attachedClusterUuids | List | 挂载的集群 | 2.3.2 |
| sharedBlocks | List | 详情参考sharedBlocks | 2.3.2 |
| sharedBlockGroupType | SharedBlockGroupType | 详情参考sharedBlockGroupType | 2.3.2 |
#sharedBlocks
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3.2 |
| sharedBlockGroupUuid | String | 共享块设备组UUID | 2.3.2 |
| diskUuid | String | 磁盘唯一标示(例如UUID, WWN, WWID) | 2.3.2 |
| name | String | 资源名称 | 2.3.2 |
| description | String | 资源的详细描述 | 2.3.2 |
| createDate | Timestamp | 创建时间 | 2.3.2 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3.2 |
| type | SharedBlockType | 详情参考type | 2.3.2 |
| state | SharedBlockState | 详情参考state | 2.3.2 |
| status | SharedBlockStatus | 详情参考status | 2.3.2 |
#type
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
#sharedBlockGroupType
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
SDK示例
Java
SDK
QuerySharedBlockGroupPrimaryStorageAction action = new QuerySharedBlockGroupPrimaryStorageAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySharedBlockGroupPrimaryStorageAction.Result res = action.call();Python
SDK
QuerySharedBlockGroupPrimaryStorageAction action = QuerySharedBlockGroupPrimaryStorageAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySharedBlockGroupPrimaryStorageAction.Result res = action.call()添加LUN到Shared Block主存储(AddSharedBlockToSharedBlockGroup)
添加共享块设备到Shared Block主存储。
API请求
URLs
POST zstack/v1/primary-storage/sharedblockgroup/{uuid}/sharedblocksHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"diskUuid": "3bc916e4700e36c9ad9575fcf47222ab"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"diskUuid":"3bc916e4700e36c9ad9575fcf47222ab"}}' http://localhost:8080/zstack/v1/primary-storage/sharedblockgroup/506367e0d66d3fdb92eda345ed347c21/sharedblocks参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| diskUuid | String | body(包含在params结构中) | 磁盘维一标示(例如UUID, WWN, WWID) | 2.3.2 | |
| uuid | String | url | 主存储UUID | 2.3.2 | |
| systemTags (可选) | List | body | 2.3.2 | ||
| userTags (可选) | List | body | 2.3.2 |
API返回
返回示例
{
"inventory": {
"sharedBlocks": [
{
"uuid": "5bc4ef2f6f703bfd9aef732be038103d",
"sharedBlockGroupUuid": "08f3dd28f1c433fe871e3fe760476981",
"type": "LvmLogicalVolumeBasic",
"diskUuid": "b9a89d214e3b37eda7a1aa948c59db13",
"name": "test shared block",
"description": "description",
"state": "Enabled",
"status": "Connected",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"sharedBlockGroupType": "LvmVolumeGroupBasic",
"uuid": "08f3dd28f1c433fe871e3fe760476981",
"name": "shared block group primary storage",
"description": "shared block group primary storage description",
"availableCapacity": 1.073741824E9,
"availablePhysicalCapacity": 1.073741824E9,
"type": "SharedBlock",
"state": "Enabled",
"status": "Connected",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.3.2 |
| inventory | SharedBlockGroupPrimaryStorageInventory | 详情参考inventory | 2.3.2 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.3.2 |
| description | String | 错误的概要描述 | 2.3.2 |
| details | String | 错误的详细信息 | 2.3.2 |
| elaboration | String | 保留字段,默认为null | 2.3.2 |
| opaque | LinkedHashMap | 保留字段,默认为null | 2.3.2 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.3.2 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3.2 |
| zoneUuid | String | 区域UUID | 2.3.2 |
| name | String | 资源名称 | 2.3.2 |
| url | String | 未使用 | 2.3.2 |
| description | String | 资源的详细描述 | 2.3.2 |
| totalCapacity | Long | 总空间 | 2.3.2 |
| availableCapacity | Long | 可用空间 | 2.3.2 |
| totalPhysicalCapacity | Long | 总物理空间 | 2.3.2 |
| availablePhysicalCapacity | Long | 物理可用空间 | 2.3.2 |
| systemUsedCapacity | Long | 系统使用空间 | 2.3.2 |
| type | String | 主存储类型 | 2.3.2 |
| state | String | 启用状态 | 2.3.2 |
| status | String | 连接状态 | 2.3.2 |
| mountPath | String | 未使用 | 2.3.2 |
| createDate | Timestamp | 创建时间 | 2.3.2 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3.2 |
| attachedClusterUuids | List | 挂载的集群 | 2.3.2 |
| sharedBlocks | List | 详情参考sharedBlocks | 2.3.2 |
| sharedBlockGroupType | SharedBlockGroupType | 详情参考sharedBlockGroupType | 2.3.2 |
#sharedBlocks
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3.2 |
| sharedBlockGroupUuid | String | 共享块设备组UUID | 2.3.2 |
| diskUuid | String | 磁盘唯一标示(例如UUID, WWN, WWID) | 2.3.2 |
| name | String | 资源名称 | 2.3.2 |
| description | String | 资源的详细描述 | 2.3.2 |
| createDate | Timestamp | 创建时间 | 2.3.2 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3.2 |
| type | SharedBlockType | 详情参考type | 2.3.2 |
| state | SharedBlockState | 详情参考state | 2.3.2 |
| status | SharedBlockStatus | 详情参考status | 2.3.2 |
#type
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
#sharedBlockGroupType
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
SDK示例
Java
SDK
AddSharedBlockToSharedBlockGroupAction action = new AddSharedBlockToSharedBlockGroupAction();
action.diskUuid = "3bc916e4700e36c9ad9575fcf47222ab";
action.uuid = "506367e0d66d3fdb92eda345ed347c21";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSharedBlockToSharedBlockGroupAction.Result res = action.call();Python
SDK
AddSharedBlockToSharedBlockGroupAction action = AddSharedBlockToSharedBlockGroupAction()
action.diskUuid = "3bc916e4700e36c9ad9575fcf47222ab"
action.uuid = "506367e0d66d3fdb92eda345ed347c21"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSharedBlockToSharedBlockGroupAction.Result res = action.call()获取共享块设备候选清单(GetSharedBlockCandidate)
API请求
URLs
GET zstack/v1/primary-storage/sharedblockgroup/sharedblock-candidatesHeaders
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/sharedblockgroup/sharedblock-candidates?clusterUuid=a8efc4d72a2334dcad7f71bcb4821d6f参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| clusterUuid | String | query | 集群UUID | 2.6.0 | |
| systemTags (可选) | List | query | 2.6.0 | ||
| userTags (可选) | List | query | 2.6.0 |
API返回
返回示例
{
"results": [
{
"wwid": "ata-Samsung_SSD_850_EVO_M.2_250GB_S33CNX0H600299D",
"vendor": "DELL",
"model": "MD32xx",
"wwn": "0x6b083fe000daf018",
"serial": "6b083fe000daf018000015505abbe00a",
"hctl": "",
"type": "mpath",
"size": 3.000318820352E13
},
{}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.6.0 |
| results | List | 详情参考results | 2.6.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.6.0 |
| description | String | 错误的概要描述 | 2.6.0 |
| details | String | 错误的详细信息 | 2.6.0 |
| elaboration | String | 保留字段,默认为null | 2.6.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 2.6.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.6.0 |
#results
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| wwid | String | 设备WWID | 2.6.0 |
| vendor | String | 设备供应商 | 2.6.0 |
| model | String | 设备型号 | 2.6.0 |
| wwn | String | 设备WWN | 2.6.0 |
| serial | String | 设备序列号 | 2.6.0 |
| hctl | String | SCSI设备HCTL | 2.6.0 |
| type | String | 设备类型 | 2.6.0 |
| size | Long | 设备大小 | 2.6.0 |
SDK示例
Java
SDK
GetSharedBlockCandidateAction action = new GetSharedBlockCandidateAction();
action.clusterUuid = "a8efc4d72a2334dcad7f71bcb4821d6f";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetSharedBlockCandidateAction.Result res = action.call();Python
SDK
GetSharedBlockCandidateAction action = GetSharedBlockCandidateAction()
action.clusterUuid = "a8efc4d72a2334dcad7f71bcb4821d6f"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetSharedBlockCandidateAction.Result res = action.call()刷新共享块设备容量(RefreshSharedblockDeviceCapacity)
API请求
URLs
POST zstack/v1/primary-storage/sharedblockgroup/{sharedBlockGroupUuid}/sharedblocks/{uuid}Headers
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/primary-storage/sharedblockgroup/2974c033608537e68a305b0f29412776/sharedblocks/9bd10e4bcc0939a2b041755a160d7b34参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid (可选) | String | url | 共享块设备UUID,如为空则更新共享块存储下所有设备 | 2.6.0 | |
| sharedBlockGroupUuid | String | url | 共享块存储UUID | 2.6.0 | |
| systemTags (可选) | List | body | 2.6.0 | ||
| userTags (可选) | List | body | 2.6.0 |
API返回
返回示例
{
"inventory": {
"sharedBlocks": [
{
"uuid": "fd474b5a711f3bcab14061e1507b0691",
"sharedBlockGroupUuid": "9f900d7cc336370da2dccdd832a1613d",
"type": "LvmLogicalVolumeBasic",
"diskUuid": "b9bec04964ab30a7bf80bdbf7ec997d9",
"name": "test shared block",
"description": "description",
"state": "Enabled",
"status": "Connected",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"sharedBlockGroupType": "LvmVolumeGroupBasic",
"uuid": "9f900d7cc336370da2dccdd832a1613d",
"name": "shared block group primary storage",
"description": "shared block group primary storage description",
"availableCapacity": 1.073741824E9,
"availablePhysicalCapacity": 1.073741824E9,
"type": "SharedBlock",
"state": "Enabled",
"status": "Connected",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.6.0 |
| inventory | SharedBlockGroupPrimaryStorageInventory | 详情参考inventory | 2.6.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.6.0 |
| description | String | 错误的概要描述 | 2.6.0 |
| details | String | 错误的详细信息 | 2.6.0 |
| elaboration | String | 保留字段,默认为null | 2.6.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 2.6.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.6.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.6.0 |
| zoneUuid | String | 区域UUID | 2.6.0 |
| name | String | 资源名称 | 2.6.0 |
| url | String | 未使用 | 2.6.0 |
| description | String | 资源的详细描述 | 2.6.0 |
| totalCapacity | Long | 总空间 | 2.6.0 |
| availableCapacity | Long | 可用空间 | 2.6.0 |
| totalPhysicalCapacity | Long | 总物理空间 | 2.6.0 |
| availablePhysicalCapacity | Long | 物理可用空间 | 2.6.0 |
| systemUsedCapacity | Long | 系统使用空间 | 2.6.0 |
| type | String | 主存储类型 | 2.6.0 |
| state | String | 启用状态 | 2.6.0 |
| status | String | 连接状态 | 2.6.0 |
| mountPath | String | 未使用 | 2.6.0 |
| createDate | Timestamp | 创建时间 | 2.6.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.6.0 |
| attachedClusterUuids | List | 挂载的集群 | 2.6.0 |
| sharedBlocks | List | 详情参考sharedBlocks | 2.6.0 |
| sharedBlockGroupType | SharedBlockGroupType | 详情参考sharedBlockGroupType | 2.6.0 |
#sharedBlocks
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.6.0 |
| sharedBlockGroupUuid | String | 共享块设备组UUID | 2.6.0 |
| diskUuid | String | 磁盘唯一标示(例如UUID, WWN, WWID) | 2.6.0 |
| name | String | 资源名称 | 2.6.0 |
| description | String | 资源的详细描述 | 2.6.0 |
| createDate | Timestamp | 创建时间 | 2.6.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.6.0 |
| type | SharedBlockType | 详情参考type | 2.6.0 |
| state | SharedBlockState | 详情参考state | 2.6.0 |
| status | SharedBlockStatus | 详情参考status | 2.6.0 |
#type
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.6.0 |
| ordinal | int | 2.6.0 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.6.0 |
| ordinal | int | 2.6.0 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.6.0 |
| ordinal | int | 2.6.0 |
#sharedBlockGroupType
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.6.0 |
| ordinal | int | 2.6.0 |
SDK示例
Java
SDK
RefreshSharedblockDeviceCapacityAction action = new RefreshSharedblockDeviceCapacityAction();
action.uuid = "9bd10e4bcc0939a2b041755a160d7b34";
action.sharedBlockGroupUuid = "2974c033608537e68a305b0f29412776";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RefreshSharedblockDeviceCapacityAction.Result res = action.call();Python
SDK
RefreshSharedblockDeviceCapacityAction action = RefreshSharedblockDeviceCapacityAction()
action.uuid = "9bd10e4bcc0939a2b041755a160d7b34"
action.sharedBlockGroupUuid = "2974c033608537e68a305b0f29412776"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RefreshSharedblockDeviceCapacityAction.Result res = action.call()查询共享块设备(QuerySharedBlock)
API请求
URLs
GET zstack/v1/sharedblock-group/sharedblocks
GET zstack/v1/sharedblock-group/
GET zstack/v1/sharedblock-group/sharedblock/{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/sharedblock-group/sharedblockscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sharedblock-group/curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sharedblock-group/sharedblock/e6076fa169ed38ba8f66e73c2db7158d可查询字段
运行CLI命令行工具,输入QuerySharedBlock并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"uuid": "3787d759b8323d2e8f0b19ef0bfe930b",
"sharedBlockGroupUuid": "0dcfcb85f7613689886ae34114064cbd",
"type": "LvmLogicalVolumeBasic",
"name": "test shared block",
"description": "description",
"state": "Enabled",
"status": "Connected",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.3.2 |
| inventories | List | 详情参考inventories | 2.3.2 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.3.2 |
| description | String | 错误的概要描述 | 2.3.2 |
| details | String | 错误的详细信息 | 2.3.2 |
| elaboration | String | 保留字段,默认为null | 2.3.2 |
| opaque | LinkedHashMap | 保留字段,默认为null | 2.3.2 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.3.2 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3.2 |
| sharedBlockGroupUuid | String | 共享块设备组UUID | 2.3.2 |
| diskUuid | String | 磁盘唯一标示(例如UUID, WWN, WWID) | 2.3.2 |
| name | String | 资源名称 | 2.3.2 |
| description | String | 资源的详细描述 | 2.3.2 |
| createDate | Timestamp | 创建时间 | 2.3.2 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3.2 |
| type | SharedBlockType | 详情参考type | 2.3.2 |
| state | SharedBlockState | 详情参考state | 2.3.2 |
| status | SharedBlockStatus | 详情参考status | 2.3.2 |
#type
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3.2 |
| ordinal | int | 2.3.2 |
SDK示例
Java
SDK
QuerySharedBlockAction action = new QuerySharedBlockAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySharedBlockAction.Result res = action.call();Python
SDK
QuerySharedBlockAction action = QuerySharedBlockAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySharedBlockAction.Result res = action.call()