Restore a Primary Cloud Director Appliance using the Appliance API
search cancel

Restore a Primary Cloud Director Appliance using the Appliance API

book

Article ID: 377023

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • Restoring a Primary Cloud Director Appliance from a backup file via the Appliance API.
  • Not using the appliance management UI (VAMI) to restore.

Environment

VMware Cloud Director 10.6

Resolution

The recommended method to restore the Primary Cloud Director Appliance from backup is to follow the documentation, Restore Your Primary VMware Cloud Director Appliance.

It is also possible to perform the restore via the Appliance API as outlined in the Appliance API documentation, Cloud Director Appliance API - /api/1.0.0/backups/{backup-name}/restore.

Example steps using curl would be as follows:

  1. Verify that you have a backup file of the primary appliance to be restored.
  2. Deploy a new primary appliance cell from the OVA, the newly deployed primary appliance version must match the backup appliance version.
    If you reuse the IP of the primary appliance, you do not need to replace the application cells later on.
    See Deployment and Initial Configuration of Your VMware Cloud Director Appliance for more details on deploying the OVA.
  3. Power off any standby cells of the failed HA cluster if they are still running.
  4. Open an SSH session to the newly deployed primary cell after powering it on for the first time.
  5. Using curl in the SSH session, mount the NFS path where the backup file of the primary appliance is located as per the Appliance API documentation, Cloud Director Appliance API - /api/1.0.0/mount.
    Use the root user password configured when deploying the new primary cell when authenticating with the Appliance API and provide the NFS path in the JSON request body.
    NOTE: The NFS path must contain a backups directory in which the backup file is located.
    The NFS mount and the share containing the backups directory must have 750 permission and vcloud.vcloud ownership. 

    For example:
    curl -kv -H 'Accept:application/json' -H 'Content-Type:application/json' -u 'root' -X PUT 'https://localhost:5480/api/1.0.0/mount' --data-raw '{"nfs":"nfs.example.com:/mnt/nfs-share"}'

  6. After mounting the NFS, list the available backups as per the Appliance API documentation, Cloud Director Appliance API - /api/1.0.0/backups.

    For example:
    curl -kv -H 'Accept:application/json' -H 'Content-Type:application/json' -u 'root' -X GET 'https://localhost:5480/api/1.0.0/backups'

  7. Restore from the desired backup file as per the Appliance API documentation, Cloud Director Appliance API - /api/1.0.0/backups/{backup-name}/restore.
    Provide the NFS path to the transfer share for the restored primary appliance in the JSON request body.
    You can use the same NFS share, or enter a new share for the restored appliance.
    Optionally select which certificates you want to restore from the backup, see the details regarding the certificates in step 6. of the documentation, Restore Your Primary VMware Cloud Director Appliance.

    For example:
    curl -kv -H 'Accept:application/json' -H 'Content-Type:application/json' -u 'root' -X POST 'https://localhost:5480/api/1.0.0/backups/backup-2024-09-24T123456+0000.zip/restore' --data-raw '{"nfs":"nfs.example.com:/mnt/nfs-share","httpCert":false,"consoleproxyCert":false,"pgmanagementCert":false}'

  8. The restore request should result in a "202 Accepted" response and provide a location response header containing a Task ID.
  9. Monitor the status of the restore task by querying the Appliance API for the Task ID as per the Appliance API documentation, Cloud Director Appliance API - /api/1.0.0/tasks/{task-id}.

    For example:
    curl -kv -H 'Accept:application/json' -H 'Content-Type:application/json' -u 'root' -X GET 'https://localhost:5480/api/1.0.0/tasks/########-####-####-####-############'

  10. Once the restore task is complete it should show a status of, stopped and a message of the form, "Backup file '<backup-file-name>' has been restored successfully".
  11. After restoring the Primary Appliance Cell follow the Cloud Director documentation, What to do next.