TakeoverPrimaryStorage
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.
API Request
URLs
PUT zstack/v1/primary-storage/{uuid}/takeoverHeaders
Authorization: OAuth the-session-uuidBody
Note: In the preceding example, the
{
"takeoverPrimaryStorage": {
"dryRun": false
},
"systemTags": [],
"userTags": []
}
Note: 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"
]
}
}#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 | The URL. | 0.6 |
| description | String | Detailed description of the resource | 0.6 |
| totalCapacity | Long | The total capacity. | 0.6 |
| availableCapacity | Long | The available capacity. | 0.6 |
| totalPhysicalCapacity | Long | The total physical capacity. | 0.6 |
| availablePhysicalCapacity | Long | The available physical capacity. | 0.6 |
| systemUsedCapacity | Long | The system used capacity. | 0.6 |
| type | String | The resource type. | 0.6 |
| state | String | The resource state. | 0.6 |
| status | String | The resource status. | 0.6 |
| mountPath | String | The mount path. | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
| attachedClusterUuids | List | The attached cluster UUIDs. | 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()