You can use the Site Recovery Manager REST APIs to run a recovery plan.
Procedure
- Make a POST request to login to the primary site.
POST BASE_URL/api/rest/srm/API_VERSION/session
- Make a GET request to get the pairing ID and the local vCenter ServerID.
GET BASE_URL/api/rest/srm/v1/pairings/
Example response:[ { "pairing_id": "7ae3c72d-9fd6-3157-bec5-07c2982bd1e8", "local_vc_server": { "id": "0a98c22d-a553-47e4-bd56-2844f45d8ef6", "url": "https://s2-srm2-219-12.eng.vmware.com:443/sdk", "name": "s2-srm2-219-12.eng.vmware.com", "server_status": "OK", }, ... ]
Save the pairing ID and the local vCenter Server ID.
- Make a GET request to get a list of all existing recovery plans.
GET BASE_URL/api/rest/srm/v1/pairings/PAIRING_ID/recovery-management/plans
Replace PAIRING_ID with the value recorded in Step 1.
Example response:[ { "id": "DrRecoveryRecoveryPlan:08ba3a70-5770-4089-a395-f11226e6fe21:93eb1820-f2fd-4238-b8fb-418cd96c1146", "status": "TEST_COMPLETE", "protected_site_name": "primary-vc", "recovery_site_name": "secondary-vc", "protected_vc_guid": "0a98c22d-a553-47e4-bd56-2844f45d8ef6", "recovery_vc_guid": "71541212-0cb3-409f-9974-1733cd53d993", "name": "rp2", "description": null, "location": "DrFolder:DrRecoveryRootFolder:93eb1820-f2fd-4238-b8fb-418cd96c1146", "location_name": "Recovery Plans", "progress": 0, "is_running": false }, {...}, {...}, {...}, ]
Save the Recovery Plan ID.
- Log in to the remote site by making a POST request.
POST BASE_URL/api/rest/srm/v1/pairings/PAIRING_ID/remote-session
Replace PAIRING_ID with the value recorded in Step 1.
Enter the user name and password for the remote Platform Services Controller in the Authentication header. - Make a POST request to run the recovery plan.
POST BASE_URL/api/rest/srm/v1/pairings/PAIRING_ID/recovery-management/plans/RECOVERY_PLAN_ID/actions/recovery
Replace PAIRING_ID with the value recorded in Step 1, and RECOVERY_PLAN_ID with the value recoded in Step 2.
Example response:{ "skip_protection_site_operations": "false", "migrate_eligible_vms": "false", "sync_data": "true", "planned_failover": "true" }