Take Over Primary Storage

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

Take over primary storage. This operation takes over shared block primary storage from another platform into the current platform. When dryRun=true, only the consistency precheck is performed: if the storage is consistent (takeover is not required), an error is returned; if the storage is inconsistent (takeover is allowed), success is returned. The takeover operation is irreversible (VG rename, PV UUID reset, and sanlock lockspace reset are performed on the agent side). After takeover is complete, reconnect is automatically triggered. You can obtain the reconnection status from the returned inventory.status.

Headers

Authorization: OAuth the-session-uuid

Body

{
  "takeoverPrimaryStorage": {
    "dryRun": false
  },
  "systemTags": [],
  "userTags": []
}

In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can include these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"takeoverPrimaryStorage":{"dryRun":false}}' \
http://localhost:8080/zstack/v1/primary-storage/ff0359abb8443d2f8077cc368afa7c00/takeover

Parameters

NameTypeLocationDescriptionOptional ValuesSince
uuidStringurlStorage UUID 5.0.0
dryRun (Optional)booleanbody (contained in the takeoverPrimaryStorage structure)Precheck mode: success indicates that takeover can be performed; failure indicates that takeover is unnecessary or cannot be performed 5.0.0
systemTags (Optional)ListbodySystem tags 5.0.0
userTags (Optional)ListbodyUser tags 5.0.0

API Response

Response Example

{
  "inventory": {
    "name": "PS1",
    "url": "/zstack_ps",
    "type": "SharedBlock",
    "attachedClusterUuids": [
      "978bb0dffae23d5da5a9c1b3e0dc4174"
    ]
  }
}
NameTypeDescriptionSince
successbooleanWhether the operation succeeded5.0.0
inventoryPrimaryStorageInventoryFor details, see inventory5.0.0
errorErrorCodeFor details, see error5.0.0

inventory

NameTypeDescriptionSince
uuidStringResource UUID, which uniquely identifies the resource0.6
zoneUuidStringZone UUID0.6
nameStringResource name0.6
urlString 0.6
descriptionStringDetailed description of the resource0.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
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6
attachedClusterUuidsList 0.6

error

NameTypeDescriptionSince
codeStringError code, which is the globally unique identifier of the error, such as SYS.1000 or HOST.10010.6
descriptionStringSummary description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. The default value is null.0.6
opaqueLinkedHashMapReserved field. The default value is null.0.6
causeErrorCodeRoot error that caused the current error. If there is no original error, this field is null.0.6

SDK Example

Java SDK

TakeoverPrimaryStorageAction action = new TakeoverPrimaryStorageAction();
action.uuid = "ff0359abb8443d2f8077cc368afa7c00";
action.dryRun = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
TakeoverPrimaryStorageAction.Result res = action.call();

Python SDK

action = TakeoverPrimaryStorageAction()
action.uuid = "ff0359abb8443d2f8077cc368afa7c00"
action.dryRun = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()