XStor Block Primary Storage Operations
AddBlockPrimaryStorage
API Request
URLs
POST zstack/v1/primary-storage/block
Headers
Authorization: OAuth the-session-uuid
Body
{
"param": {
"vendorName": "XStor",
"metadata": "{\u0027ip\u0027:\u0027127.0.0.1\u0027, \u0027port\u0027:8443, \u0027username\u0027:\u0027test\u0027, \u0027password\u0027:\u0027password\u0027}"
},
"systemTags": [],
"userTags": []
}
In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"param":{"vendorName":"XStor","metadata":"{'ip':'127.0.0.1', 'port':8443, 'username':'test', 'password':'password'}"}}' http://localhost:8080/zstack/v1/primary-storage/block
Request Parameters
| Name | Type | Location | Description | Valid Values | Starting Version |
|---|---|---|---|---|---|
| vendorName | String | body (contained in the param structure) |
The storage vendor name. | 4.6.0 | |
| metadata | String | body (contained in the param structure) |
The storage metadata. | 4.6.0 | |
| url | String | body (contained in the param structure) |
Unused. | 4.6.0 | |
| name | String | body (contained in the paramstructure) |
The name of the Block primary storage. | 4.6.0 | |
| description | String | body (contained in the param structure) |
Optional. The detailed description of the Block primary storage. | 4.6.0 | |
| type | String | body (contained in the param structure) |
Optional. The primary storage type. The type is Block here. | 4.6.0 | |
| zoneUuid | String | body (contained in the param structure) |
The zone UUID. | 4.6.0 | |
| resourceUuid | String | body(contained in the param structure) |
Optional. The resource UUID. | 4.6.0 | |
| tagUuids | List | body (contained in the paramstructure) |
Optional. The tag UUID list. | 4.6.0 | |
| systemTags | List | body | Optional. The system tags. | 4.6.0 | |
| userTags | List | body | Optional. The user tags. | 4.6.0 |
API Response
Response Sample
{
"inventory": {
"name": "PS1",
"url": "/zstack_ps",
"type": "LocalStorage",
"state": "Enabled",
"status": "Connected",
"attachedClusterUuids": [
"c6e9684e8bb93a9192c946dcd0564b39"
]
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, seeerror | 4.6.0 |
| inventory | PrimaryStorageInventory | For detailed version, see inventory. | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.6.0 |
| description | String | The brief description of the error. | 4.6.0 |
| details | String | The details about the error. | 4.6.0 |
| elaboration | String | The reserved field. Default value: null. | 4.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.6.0 |
| zoneUuid | String | The zone UUID. | 4.6.0 |
| name | String | The resource name. | 4.6.0 |
| url | String | The URL. | 4.6.0 |
| description | String | The detailed information of the resource. | 4.6.0 |
| totalCapacity | Long | The total capacity. | 4.6.0 |
| availableCapacity | Long | The available capacity. | 4.6.0 |
| totalPhysicalCapacity | Long | The total physical capacity. | 4.6.0 |
| availablePhysicalCapacity | Long | The available physical capacity. | 4.6.0 |
| systemUsedCapacity | Long | The system used capacity. | 4.6.0 |
| type | String | The primary storage type. | 4.6.0 |
| state | String | The running state. | 4.6.0 |
| status | String | The connection status. | 4.6.0 |
| mountPath | String | The mount path. | 4.6.0 |
| createDate | Timestamp | The creation date. | 4.6.0 |
| lastOpDate | Timestamp | The last operation date. | 4.6.0 |
| attachedClusterUuids | List | The cluster attached to. | 4.6.0 |
SDK Sample
Java SDK
AddBlockPrimaryStorageAction action = new AddBlockPrimaryStorageAction();
action.vendorName = "XStor";
action.metadata = "{'ip':'127.0.0.1', 'port':8443, 'username':'test', 'password':'password'}";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddBlockPrimaryStorageAction.Result res = action.call();
Python SDK
action = AddBlockPrimaryStorageAction()
action.vendorName = "XStor"
action.metadata = "{'ip':'127.0.0.1', 'port':8443, 'username':'test', 'password':'password'}"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
GetBlockPrimaryStorageMetadata
API Request
URLs
POST zstack/v1/primary-storage/block/metadata
Headers
Authorization: OAuth the-session-uuid
Body
{
"param": {
"vendorName": "XStor",
"metadata": "{\u0027ip\u0027:\u0027127.0.0.1\u0027,\u0027port\u0027:8443,\u0027username\u0027:\u0027test\u0027,\u0027password\u0027:\u0027123\u0027}"
},
"systemTags": [],
"userTags": []
}
In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"param":{"vendorName":"XStor","metadata":"{'ip':'127.0.0.1','port':8443,'username':'test','password':'123'}"}}' http://localhost:8080/zstack/v1/primary-storage/block/metadata
Request Parameters
| Name | Type | Location | Description | Valid Values | Starting Version |
|---|---|---|---|---|---|
| vendorName | String | body (contained in the param structure) | The name of the Block storage vendor. | 4.6.0 | |
| metadata | String | body (contained in the param structure) | The storage metadata (IP, port, user name, and password). | 4.6.0 | |
| systemTags | List | body | Optional. The system tags. | 4.6.0 | |
| userTags | List | body | Optional. The user tags. | 4.6.0 |
API Response
Sample Response
{
"inventories": [
{
"vendorName": "XStor",
"uuid": "8f93d463f7d73e1c959aee815ff1e9a8"
}
]
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.6.0 |
| inventory | PrimaryStorageInventory | For more information, see inventory | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.6.0 |
| description | String | The brief description of the error. | 4.6.0 |
| details | String | The details about the error. | 4.6.0 |
| elaboration | String | The reserved field. Default value: null. | 4.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.6.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| vendorName | String | The storage vendor name. | 4.6.0 |
| metadata | String | The storage metadata. | 4.6.0 |
| uuid | String | The resource UUID. | 4.6.0 |
| zoneUuid | String | The zone UUID. | 4.6.0 |
| name | String | The primary storage name. | 4.6.0 |
| url | String | Unused. | 4.6.0 |
| description | String | Optional. The detailed description of the resource. | 4.6.0 |
| totalCapacity | Long | The total capacity. | 4.6.0 |
| availableCapacity | Long | The available capacity. | 4.6.0 |
| totalPhysicalCapacity | Long | The total physical capacity. | 4.6.0 |
| availablePhysicalCapacity | Long | The available physical capacity. | 4.6.0 |
| systemUsedCapacity | Long | The used system capacity. | 4.6.0 |
| type | String | The primary storage type. | 4.6.0 |
| state | String | The running state. | 4.6.0 |
| status | String | The connection status. | 4.6.0 |
| mountPath | String | Used. | 4.6.0 |
| createDate | Timestamp | The creation date. | 4.6.0 |
| lastOpDate | Timestamp | The last operation date. | 4.6.0 |
| attachedClusterUuids | List | The cluster attached to. | 4.6.0 |
SDK Sample
Java SDK
GetBlockPrimaryStorageMetadataAction action = new GetBlockPrimaryStorageMetadataAction();
action.vendorName = "XStor";
action.metadata = "{'ip':'127.0.0.1','port':8443,'username':'test','password':'123'}";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetBlockPrimaryStorageMetadataAction.Result res = action.call();
Python SDK
action = GetBlockPrimaryStorageMetadataAction()
action.vendorName = "XStor"
action.metadata = "{'ip':'127.0.0.1','port':8443,'username':'test','password':'123'}"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
QueryBlockPrimaryStorage
API Request
URLs
GET zstack/v1/primary-storage/block
GET zstack/v1/primary-storage/block/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/block
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/block/27520555d8e2373e9a7ec3801e358e1c
Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack, entering QueryBlockPrimaryStorage, and pressing the Tab key.
API Response
Sample Response
{
"inventories": [
{
"vendorName": "XStor",
"uuid": "8f93d463f7d73e1c959aee815ff1e9a8"
}
]
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.6.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.6.0 |
| inventory | PrimaryStorageInventory | For more information, see inventories | 4.6.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.6.0 |
| description | String | The brief description of the error. | 4.6.0 |
| details | String | The details about the error. | 4.6.0 |
| elaboration | String | The reserved field. Default value: null. | 4.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.6.0 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| vendorName | String | The storage vendor name. | 4.6.0 |
| metadata | String | The storage metadata. | 4.6.0 |
| uuid | String | The resource UUID. | 4.6.0 |
| zoneUuid | String | The zone UUID. | 4.6.0 |
| name | String | The primary storage name. | 4.6.0 |
| url | String | Unused. | 4.6.0 |
| description | String | Optional. The detailed description of the resource. | 4.6.0 |
| totalCapacity | Long | The total capacity. | 4.6.0 |
| availableCapacity | Long | The available capacity. | 4.6.0 |
| totalPhysicalCapacity | Long | The total physical capacity. | 4.6.0 |
| availablePhysicalCapacity | Long | The available physical capacity. | 4.6.0 |
| systemUsedCapacity | Long | The system used capacity. | 4.6.0 |
| type | String | The primary storage type. | 4.6.0 |
| state | String | The running state. | 4.6.0 |
| status | String | The connection state. | 4.6.0 |
| mountPath | String | Unused. | 4.6.0 |
| createDate | Timestamp | The creation date. | 4.6.0 |
| lastOpDate | Timestamp | The last operation date. | 4.6.0 |
| attachedClusterUuids | List | The cluster attached to. | 4.6.0 |
SDK Sample
Java SDK
QueryBlockPrimaryStorageAction action = new QueryBlockPrimaryStorageAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryBlockPrimaryStorageAction.Result res = action.call();
Python SDK
action = QueryBlockPrimaryStorageAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
UpdateBlockPrimaryStorage
API Request
URLs
PUT zstack/v1/primary-storage/block/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateBlockPrimaryStorage": {
"vendorName": "XStor",
"metadata": "{\u0027ip\u0027:\u0027127.0.0.1\u0027, \u0027port\u0027:8443, \u0027user\u0027:\u0027test\u0027, \u0027password\u0027:\u0027password\u0027}"
},
"systemTags": [],
"userTags": []
}
In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateBlockPrimaryStorage":{"vendorName":"XStor","metadata":"{'ip':'127.0.0.1', 'port':8443, 'user':'test', 'password':'password'}"}}' \
http://localhost:8080/zstack/v1/primary-storage/block/blockPrimarySttorageUuid/actions
Request Parameters
| Name | Type | Location | Description | Valid Values | Starting Version |
|---|---|---|---|---|---|
| vendorName | String | body (contained in the params structure) | Optional. The storage vendor name. | 4.8.0 | |
| metadata | String | body (contained in the params structure) | Optional. The storage metadata. | 4.8.0 | |
| uuid | String | url | The resource UUID. | 4.8.0 | |
| systemTags | List | body | Optional. The system tags. | 4.8.0 | |
| userTags | List | body | Optional. The user tags. | 4.8.0 |
API Response
Response Sample
{
"inventory": {
"vendorName": "XStor",
"metadata": "{\u0027ip\u0027:\u0027127.0.0.1\u0027, \u0027port\u0027:8443, \u0027user\u0027:\u0027test\u0027, \u0027password\u0027:\u0027password\u0027}",
"uuid": "c85e957b4b4b3f949494275d443c9807",
"name": "block primary storage",
"description": "block primary storage description",
"availableCapacity": 1073741824,
"availablePhysicalCapacity": 1073741824,
"type": "BlockStorage",
"state": "Enabled",
"status": "Connected",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
}
| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.8.0 |
| inventory | BlockPrimaryStorageInventory | For detailed version, see inventory. | 4.8.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, seeerror | 4.8.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| vendorName | String | The storage vendor name. | 4.8.0 |
| metadata | String | The storage metadata. | 4.8.0 |
| uuid | String | The resource UUID. | 4.8.0 |
| zoneUuid | String | The zone UUID. | 4.8.0 |
| name | String | The resource name. | 4.8.0 |
| url | String | The URL. | 4.8.0 |
| description | String | The detailed information of the resource. | 4.8.0 |
| totalCapacity | Long | The total capacity. | 4.8.0 |
| availableCapacity | Long | The available capacity. | 4.8.0 |
| totalPhysicalCapacity | Long | The total physical capacity. | 4.8.0 |
| availablePhysicalCapacity | Long | The available physical capacity. | 4.8.0 |
| systemUsedCapacity | Long | The system used capacity. | 4.8.0 |
| type | String | The primary storage type. | 4.8.0 |
| state | String | The running state. | 4.8.0 |
| status | String | The connection status. | 4.8.0 |
| mountPath | String | The mount path. | 4.8.0 |
| createDate | Timestamp | The creation date. | 4.8.0 |
| lastOpDate | Timestamp | The last operation date. | 4.8.0 |
| attachedClusterUuids | List | The cluster attached to. | 4.8.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.8.0 |
| description | String | The brief description of the error. | 4.8.0 |
| details | String | The details about the error. | 4.8.0 |
| elaboration | String | The reserved field. Default value: null. | 4.8.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.8.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 4.8.0 |
SDK Sample
Java SDK
UpdateBlockPrimaryStorageAction action = new UpdateBlockPrimaryStorageAction();
action.vendorName = "XStor";
action.metadata = "{'ip':'127.0.0.1', 'port':8443, 'user':'test', 'password':'password'}";
action.uuid = "blockPrimarySttorageUuid";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateBlockPrimaryStorageAction.Result res = action.call();
Python SDK
action = UpdateBlockPrimaryStorageAction()
action.vendorName = "XStor"
action.metadata = "{'ip':'127.0.0.1', 'port':8443, 'user':'test', 'password':'password'}"
action.uuid = "blockPrimarySttorageUuid"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
