Change Data Storage State

PUT/zstack/v1/primary-storage/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changePrimaryStorageState": {
    "stateEvent": "Disabled"
  },
  "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 Example

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/actions

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

uuid

String

url

Data Storage UUID, uniquely identifies the resource

 

0.6

stateEvent

String

body(contained in the changePrimaryStorageState structure)

Target state for the Data Storage

  • enable
  • disable
  • maintain
  • deleting

0.6

systemTags (Optional)

List

body

 

 

0.6

userTags (Optional)

List

body

User Tags

 

0.6

API Response

Response Example

{
  "inventory": {
    "name": "PS1",
    "url": "/Cloud_ps",
    "type": "LocalStorage",
    "state": "Disabled",
    "attachedClusterUuids": [
      "408395dfdebb427e9453048436556a66"
    ]
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, the operation failed. When the operation succeeds, this field is null. See error0.6
inventoryPrimaryStorageInventorySee inventory0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, for example SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause, the source error that caused the current error. If there is no original error, this field is null0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource0.6
zoneUuidStringData Center UUID0.6
nameStringResource Name0.6
urlString 0.6
descriptionStringResource Description0.6
totalCapacityLong 0.6
availableCapacityLong 0.6
totalPhysicalCapacityLong 0.6
availablePhysicalCapacityLong 0.6
systemUsedCapacityLong 0.6
typeString 0.6
stateString 0.6
statusString 0.6
mountPathString 0.6
createDateTimestampCreate Time0.6
lastOpDateTimestampLast Modification Time0.6
attachedClusterUuidsList 0.6

SDK Examples

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()