Add Local Storage as Data Storage
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"url": "/Cloud_ps",
"name": "PS1",
"zoneUuid": "a71cbd7404e9474c81ed45d167b7eab8"
},
"systemTags": [],
"userTags": []
}In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.
Curl Examples
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"url":"/Cloud_ps","name":"PS1","zoneUuid":"3b9a66322185343e9068b2bfd185b690"}}' \
http://localhost:8080/zstack/v1/primary-storage/local-storageParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| url | String | body (nested in params structure) | Local storage path | 0.6 | |
| name | String | body (nested in params structure) | Local storage data storage name | 0.6 | |
| description (optional) | String | body (nested in params structure) | Detailed description of the local storage data storage | 0.6 | |
| type (optional) | String | body (nested in params structure) | Type is LocalStorage | 0.6 | |
| zoneUuid | String | body (nested in params structure) | Data Center UUID | 0.6 | |
| resourceUuid (optional) | String | body (nested in params structure) | Resource UUID. If specified, the local storage data storage will use this value as its UUID. | 0.6 | |
| systemTags (optional) | List | body | System tags | 0.6 | |
| userTags (optional) | List | body | User tags | 0.6 |
API Response
Response Example
{
"inventory": {
"name": "PS1",
"url": "/Cloud_ps",
"type": "LocalStorage",
"state": "Enabled",
"status": "Connected",
"attachedClusterUuids": [
"562116d368c8467c95c53321757538dc"
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | Error code. If not null, indicates the operation failed. This field is null when the operation succeeds. For details, see error | 0.6 |
| inventory | PrimaryStorageInventory | For details, see inventory | 0.6 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, globally unique identifier for the error, such as SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed error information | 0.6 |
| elaboration | String | Reserved field, defaults to null | 0.6 |
| opaque | LinkedHashMap | Reserved field, defaults to null | 0.6 |
| cause | ErrorCode | Root cause. The source error that triggered the current error. If there is no original error, this field is null | 0.6 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 0.6 |
| zoneUuid | String | Data Center UUID | 0.6 |
| name | String | Resource name | 0.6 |
| url | String | 0.6 | |
| description | String | Detailed description of the resource | 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 | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
| attachedClusterUuids | List | 0.6 |
SDK Examples
Java SDK
AddLocalPrimaryStorageAction action = new AddLocalPrimaryStorageAction();
action.url = "/Cloud_ps";
action.name = "PS1";
action.zoneUuid = "e9762e3b848e4d0a8f36f1b2fe888b14";
action.sessionId = "01b750dce9e94191abd9216fe8c5e77b";
AddLocalPrimaryStorageAction.Result res = action.call();Python SDK
AddLocalPrimaryStorageAction action = AddLocalPrimaryStorageAction()
action.url = "/Cloud_ps"
action.name = "PS1"
action.zoneUuid = "bd54c662683b4144b33a72a357064387"
action.sessionId = "b6dd1fd80b7144adbf23d4b1089d978d"
AddLocalPrimaryStorageAction.Result res = action.call()