Restoring a Storage Volume Across Sites

In this example, let's consider that your domain contains two sites: site A and site B. /Compute-acme/jack.jones@example.com/vol1 is a storage volume in site A. Back up this storage volume by creating a remote snapshot of this storage volume. Remote snapshots are stored in an associated Oracle Cloud Infrastructure Object Storage Classic instance. In this example, /Compute-acme/cloud_storage is the Oracle Cloud Infrastructure Object Storage Classic account associated with sites A and B. The Oracle Cloud Infrastructure Object Storage Classic account, /Compute-acme/cloud_storage, should be available on both sites so that the storage volume can be restored. In site B, you can create a storage volume using the remote snapshot stored in /Compute-acme/cloud_storage to restore the storage volume.

To restore a storage volume across sites:

  1. Create a remote snapshot of /Compute-acme/jack.jones@example.com/vol1 storage volume by sending the POST /storage/snapshot/ HTTP request.

    Sample command

    curl -i -X POST
         -H "Cookie: $COMPUTE_COOKIE"
         -H "Content-Type: application/oracle-compute-v3+json"
         -H "Accept: application/oracle-compute-v3+json"
         -d "@requestbody.json"
            https://api-z999.compute.us0.oraclecloud.com/storage/snapshot/
    • COMPUTE_COOKIE is the name of the variable in which you stored the authentication cookie earlier. For information about retrieving the authentication cookie and storing it in a variable, see Authentication.

    • api-z999.compute.us0.oraclecloud.com is an example REST endpoint URL. Change this value to the REST endpoint URL of your Compute Classic site. For information about finding out REST endpoint URL for your site, see Send Requests.

    • acme and jack.jones@example.com are example values. Replace acme with the identity domain ID of your Compute Classic account, and jack.jones@example.com with your user name.

    • /Compute-acme/jack.jones@example.com/vol1 is the name of the storage volume. In this example, we are finding the name of the instance that is attached to this storage volume. Replace this with the multipart name of the storage volume in your environment.

    Sample request body

    The following shows an example of the request body content in the requestbody.json file. While creating a remote storage snapshot, don???t specify a value for the property parameter.

    {
      "volume": "/Compute-acme/jack.jones@example.com/vol1",
      "description": "Remote snapshot of vol1"
    }

    Sample response body

    {
      "status": "initializing",
      "start_timestamp": "2017-05-19T10:14:03Z",
      "account": "/Compute-acme/cloud_storage",
      "repl_target_regions": null,
      "description": "Remote snapshot of vol1",
      "tags": [],
      "snapshot_timestamp": null,
      "snapshot_id": "a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0",
      "image_metadata_bag": null,
      "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/snapshot/Compute-acme/jack.jones@example.com/vol1/a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0",
      "status_detail": "The storage snapshot is currently being initialized.",
      "volume": "/Compute-acme/jack.jones@example.com/vol1",
      "platform": null,
      "machineimage_name": null,
      "size": "10737418240",
      "status_timestamp": "2017-05-19T10:14:03Z",
      "repl_source_region": "us0",
      "property": "/oracle/public/storage/snapshot/default",
      "parent_volume_bootable": "false",
      "name": "/Compute-acme/jack.jones@example.com/vol1/a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0"
    }

    In the response body, note down the multi-part name of the remote storage snapshot. You???ll need to provide this name while sending the GET /storage/snapshot/{name} HTTP request to track the status of the storage snapshot.

  2. Creating a remote snapshot can take quite a long time depending on the size of the storage volume, as data is written to and from the Oracle Cloud Infrastructure Object Storage Classic instance. Check the status of the remote snapshot by sending the GET /storage/snapshot/{name} HTTP request.

    When the status changes to completed, the remote snapshot has been created. In the response body, note down the snapshot_id and . You???ll need to provide this information when you are restoring a storage volume from this remote snapshot.

    Sample command

    curl -X GET 
         -H "Cookie: $COMPUTE_COOKIE"
         -H "Accept: application/oracle-compute-v3+json"
         https://api-z999.compute.us0.oraclecloud.com/storage/snapshot/Compute-acme/jack.jones@example.com/vol1/a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0

    Sample response body

    {
      "status": "completed",
      "start_timestamp": "2017-05-19T10:14:03Z",
      "account": "/Compute-acme/cloud_storage",
      "repl_target_regions": null,
      "description": "Remote snapshot of vol1",
      "tags": [],
      "snapshot_timestamp": "2017-05-19T09:58:58Z",
      "snapshot_id": "a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0",
      "image_metadata_bag": null,
      "uri": "https://10.252.131.5/storage/snapshot/Compute-acme/sylaja.kannan%40oracle.com/vol1/a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0",
      "status_detail": "The storage snapshot is in completed state",
      "volume": "/Compute-acme/jack.jones@example.com/vol1",
      "platform": null,
      "machineimage_name": null,
      "size": "10737418240",
      "status_timestamp": "2017-05-19T10:15:26Z",
      "repl_source_region": "us0",
      "property": "/oracle/public/storage/snapshot/default",
      "parent_volume_bootable": "false",
      "name": "/Compute-acme/jack.jones@example.com/vol1/a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0"
    }
  3. Get an authentication cookie from Compute Classic by submitting a POST request on the REST endpoint URL of site B.

    Sample command

    curl -i -X POST
         -H "Content-Type: application/oracle-compute-v3+json"
         -d '{"user":"/Compute-acme/jack.jones@example.com","password":"pwd-siteB"}'
            https://api-z888.compute.us0.oraclecloud.com/authenticate/

    In the response body, note the value of the Set-Cookie header, and then save this value in an environment variable, COMPUTE_COOKIE.

  4. Create the restored storage volume by sending the POST /storage/volume/ HTTP request.

    Sample command

    curl -i -X POST
         -H "Cookie: $COMPUTE_COOKIE"
         -H "Content-Type: application/oracle-compute-v3+json"
         -d "@restore.json"
            https://api-z888.compute.us0.oraclecloud.com/storage/volume/

    Sample request body

    The following shows an example of the request body content in the restore.json file. You must specify values for the following parameters: name, size, snapshot_id, and properties. If you are restoring a bootable storage volume from a snapshot, then you must specify the bootable parameter as well. You must specify the snapshot_id of the snapshot from which you want to restore the storage volume. For size, specify a size which is same or greater than the size of the snapshot.

    {
     "snapshot_id": "a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0",
     "name": "/Compute-acme/jack.jones@example.com/remote-restored-vol1"
     "properties": ["/oracle/public/storage/default"],
     "size": "12G",
    }

    Sample response body

    {
      "managed": true,
      "snapshot_id": "a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0",
      "image_metadata_bag": null,
      "snapshot_account": "/Compute-acme/cloud_storage",
      "machineimage_name": null,
      "status_timestamp": "2017-05-19T20:23:41Z",
      "imagelist": null,
      "writecache": false,
      "size": "12884901888",
      "platform": null,
      "readonly": false,
      "storage_pool": null,
      "shared": false,
      "status": "Initializing",
      "description": null,
      "tags": [],
      "quota": null,
      "status_detail": "The storage volume is currently being initialized.",
      "properties": [
        "/oracle/public/storage/default"
      ],
      "account": "/Compute-acme/default",
      "name": "/Compute-acme/jack.jones@example.com/remote-restored-vol1",
      "bootable": false,
      "hypervisor": null,
      "uri": "https://api-z888.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/remote-restored-vol1",
      "imagelist_entry": -1,
      "snapshot": "/Compute-acme/jack.jones@example.com/vol1/a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0"
    }

    When the status of the storage volume changes from Initializing to Online, the storage volume has been created.

See Also: