CreateBlockVolume
API Request
URLs
POST zstack/v1/block-volumesHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "example",
"description": "block volume test"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"params":{"name":"example","description":"block volume test"}}'
http://localhost:8080/zstack/v1/block-volumesRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The resource name. | 4.7.11 | |
| description | String | body (contained in the params structure) | Optional. Optional. The detailed description of the resource. | 4.7.11 | |
| size | Long | body (contained in the params structure) | The size. | 4.7.11 | |
| primaryStorageUuid | String | body (contained in the params structure) | The primary storage UUID. | 4.7.11 | |
| accessPathId | Integer | body (contained in the params structure) | Optional. The access path id. | 5.1.0 | |
| accessPathIqn | String | body (contained in the params structure) | Optional. The access path iqn. | 4.7.11 | |
| burstTotalBw | Long | body (contained in the params structure) | Optional. The burst total bandwidth. | 4.7.11 | |
| burstTotalIops | Long | body (contained in the params structure) | Optional. The burst total IOPS. | 4.7.11 | |
| maxTotalBw | Long | body (contained in the params structure) | Optional. The maxmium total bandwidth. | 4.7.11 | |
| maxTotalIops | Long | body (contained in the params structure) | Optional. The maximum total IOPS. | 4.7.11 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 4.7.11 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 4.7.11 | |
| systemTags | List | body | Optional. The system tags. | 4.7.11 | |
| userTags | List | body | Optional. The user tags. | 4.7.11 | |
| protocol | String | Optional.The protocol. | 5.1.0 |
API Response
Response Sample
{
"inventory": {}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.7.11 | |
| inventory | VolumeInventory | See inventory. | 4.7.11 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.7.11 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| iscsiPath | String | 4.7.11 | |
| vendor | String | 4.7.11 | |
| uuid | String | The resource UUID. | 4.7.11 |
| name | String | The resource name. | 4.7.11 |
| description | String | Optional. The detailed description of the resource. | 4.7.11 |
| primaryStorageUuid | String | The primary storage UUID. | 4.7.11 |
| vmInstanceUuid | String | The VM Instance UUID. | 4.7.11 |
| diskOfferingUuid | String | The disk offering 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 | The creation date. | 4.7.11 |
| lastOpDate | Timestamp | The last operation date. | 4.7.11 |
| isShareable | Boolean | 4.7.11 | |
| volumeQos | String | 4.7.11 | |
| lastDetachDate | Timestamp | 4.7.11 | |
| lastVmInstanceUuid | String | 4.7.11 |
#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.7.0 |
| description | String | The brief description of the error. | 4.7.0 |
| details | String | The details about the error. | 4.7.0 |
| elaboration | String | The reserved field. Default value: null. | 4.7.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.7.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.7.0 |
SDK Sample
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()