ChangePrimaryStorageState
API Request
URLs
PUT zstack/v1/primary-storage/{uuid}/actionsHeaders
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.
{
"changePrimaryStorageState": {
"stateEvent": "Disabled"
},
"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 PUT -d '{"changePrimaryStorageState":{"stateEvent":"disable"}}' \
http://localhost:8080/zstack/v1/primary-storage/2e9c3a048ce03f5db297da323061a0de/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The primary storage UUID. | 0.6 | |
| stateEvent | String | body (contained in the changePrimaryStorageState structure) | The target state of the primary storage. |
|
0.6 |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"name": "PS1",
"url": "/Cloud_ps",
"type": "LocalStorage",
"state": "Disabled",
"attachedClusterUuids": [
"408395dfdebb427e9453048436556a66"
]
}
}#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. | 0.6 |
| description | String | The detailed description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| zoneUuid | String | The zone UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| url | String | 0.6 | |
| description | String | The 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 | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| attachedClusterUuids | List | 0.6 |
SDK Sample
Java
SDK
ChangePrimaryStorageStateAction action = new ChangePrimaryStorageStateAction();
action.uuid = "236d97d1752643018266bb4151d6a431";
action.stateEvent = "Disabled";
action.sessionId = "bf409a0349c44104ab3dbb77415847a0";
ChangePrimaryStorageStateAction.Result res = action.call();Python
SDK
ChangePrimaryStorageStateAction action = ChangePrimaryStorageStateAction()
action.uuid = "5c612d1387af4d13b381db54c7307059"
action.stateEvent = "Disabled"
action.sessionId = "441b4bd8c5e54003b62af7e4c44db8c1"
ChangePrimaryStorageStateAction.Result res = action.call()