Take Over Primary Storage
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-uuidBody
{
"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/takeoverParameters
| Name | Type | Location | Description | Optional Values | Since |
|---|---|---|---|---|---|
| uuid | String | url | Storage UUID | 5.0.0 | |
| dryRun (Optional) | boolean | body (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) | List | body | System tags | 5.0.0 | |
| userTags (Optional) | List | body | User tags | 5.0.0 |
API Response
Response Example
{
"inventory": {
"name": "PS1",
"url": "/zstack_ps",
"type": "SharedBlock",
"attachedClusterUuids": [
"978bb0dffae23d5da5a9c1b3e0dc4174"
]
}
}| Name | Type | Description | Since |
|---|---|---|---|
| success | boolean | Whether the operation succeeded | 5.0.0 |
| inventory | PrimaryStorageInventory | For details, see inventory | 5.0.0 |
| error | ErrorCode | For details, see error | 5.0.0 |
inventory
| Name | Type | Description | Since |
|---|---|---|---|
| uuid | String | Resource UUID, which uniquely identifies the resource | 0.6 |
| zoneUuid | String | Zone 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 |
error
| Name | Type | Description | Since |
|---|---|---|---|
| code | String | Error code, which is the globally unique identifier of the error, such as SYS.1000 or HOST.1001 | 0.6 |
| description | String | Summary description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. The default value is null. | 0.6 |
| opaque | LinkedHashMap | Reserved field. The default value is null. | 0.6 |
| cause | ErrorCode | Root 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()