如何使用 REST API 執行復原計劃

您可以使用
Site Recovery Manager
REST API 執行復原計劃。
  1. 發出
    POST
    請求以登入主要站台。
    POST BASE_URL/api/rest/srm/
    API_VERSION
    /session
  2. 發出
    GET
    請求以取得配對識別碼和本機
    vCenter Server
    識別碼。
    GET BASE_URL/api/rest/srm/v1/pairings/
    回應範例:
    [ { "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", }, ... ]
    儲存配對識別碼和本機
    vCenter Server
    識別碼。
  3. 發出
    GET
    請求,以取得所有現有復原計劃的清單。
    GET BASE_URL/api/rest/srm/v1/pairings/
    PAIRING_ID
    /recovery-management/plans
    PAIRING_ID
    替換為在步驟 1 中記錄的值。
    回應範例:
    [ { "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 }, {...}, {...}, {...}, ]
    儲存復原計劃識別碼。
  4. 透過發出
    POST
    請求登入遠端站台。
    POST BASE_URL/api/rest/srm/v1/pairings/PAIRING_ID/remote-session
    PAIRING_ID
    替換為在步驟 1 中記錄的值。
    在「驗證」標頭中輸入遠端
    Platform Services Controller
    的使用者名稱和密碼。
  5. 發出
    POST
    請求,以執行復原計劃。
    POST
    BASE_URL
    /api/rest/srm/v1/pairings/
    PAIRING_ID
    /recovery-management/plans/
    RECOVERY_PLAN_ID
    /actions/recovery
    PAIRING_ID
    替換為在步驟 1 中記錄的值,並將
    RECOVERY_PLAN_ID
    替換為在步驟 2 中記錄的值。
    回應範例:
    { "skip_protection_site_operations": "false", "migrate_eligible_vms": "false", "sync_data": "true", "planned_failover": "true" }