When performing a file-based restore of the SDDC Manager appliance, the curl command fails with a 400 BAD REQUEST error.
search cancel

When performing a file-based restore of the SDDC Manager appliance, the curl command fails with a 400 BAD REQUEST error.

book

Article ID: 444244

calendar_today

Updated On:

Products

VMware SDDC Manager / VCF Installer

Issue/Introduction

On running the workflow to restore the SDDC manager from the host appliance:

curl https://<sddc_manager_fqdn>/v1/restores/tasks -k -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
    -d '{
  "elements" : [ {
    "resourceType" : "SDDC_MANAGER"
  } ],
  "backupFile" : "<backup_file>",
  "encryption" : {
    "passphrase" : "<encryption_password>"
  }
}'

The command fails with the error: 

{ "errorCode": "RESTORE_FAILED", "arguments": [ "An exception 400 BAD REQUEST: \"{\"causes\": [{\"message\":\"Invalid backup tar file\", \"type\":null}], \"errorCode\": \"BACKUP_FILE_INVALID\", \"message\":\"Backup file <backup_file_location> does not exist.\"}\"" ....

 

Environment

SDDC Manager 5.x

SDDC Manager 9.x

Cause

This issue occurs because the path provided in the backupFile parameter of the API request refers to a location on the host machine (from where the curl command is being executed) instead of a local path on the SDDC Manager appliance.

While the documentation(Restore SDDC Manager from a File-Based Backup) instructs the user to run the command from a host machine with network access to the SDDC Manager, the SDDC Manager API expects the backup file to already reside on its own local file system (at/tmp/) or at a reachable absolute path within its environment.

Resolution

To resolve this, ensure the backup file is copied to the SDDC Manager appliance before initiating the restore task.

  1. Ensure the backup tar file is copied in the /tmp folder on the SDDC manager.
  2. Verify that the VCF user has permissions to this file.
    ls -l <filename>
  3. Run the Restore Command with the correct path: 
    curl https://<sddc_manager_fqdn>/v1/restores/tasks -k -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
        -d '{
      "elements" : [ {
        "resourceType" : "SDDC_MANAGER"
      } ],
      "backupFile" : "<absolution_path_of_backup_file_on_SDDC>",
      "encryption" : {
        "passphrase" : "<encryption_password>"
      }
    }'