To create a snapshot of a First Class Disk (FCD), you make a POST request with the block device ID of the FCD. Using the snapshot ID created, you can revert an FCD to a snapshot or delete a snapshot of an FCD.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Automation Assembler Infrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
- Verify that you have created an FCD and you have a block device ID. See Create a First Class Disk.
Procedure
Example: Create snapshots of a First Class Disk and revert an FCD to a snapshot
With the block device ID from the created FCD, create multiple snapshots of an FCD.
$ url='https://api.mgmt.cloud.vmware.com'
$ api_version='2021-07-15'
$ block_device_id='e1cbc8e1-76bb-4bef-8e51-a582437266c2'
Create a snapshot of the FCD.
$ curl -X POST \ $url/iaas/api/block-devices/$block_device_id/operations/snapshots?apiVersion=$api_version \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "description": "Example description 1" }' | jq "."
The response provides a selfLink to the request.
{ "progress": 0, "status": "INPROGRESS", "name": "Provisioning", "id": "d08bb46c-cf7e-40b6-bdf8-893390ba4d51", "selfLink": "/iaas/api/request-tracker/d08bb46c-cf7e-40b6-bdf8-893390ba4d51" }
Assign the selfLink ID variable.
$ selfLink_id='d08bb46c-cf7e-40b6-bdf8-893390ba4d51'
Track the progress of the request.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version | jq "."
Create a second snapshot of the FCD.
$ curl -X POST \ $url/iaas/api/block-devices/$block_device_id/operations/snapshots?apiVersion=$api_version \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "description": "Example description 2" }' | jq "."
List all the snapshots of the FCD.
curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots?apiVersion=$api_version | jq "."
Examine the response to see all snapshot IDs.
[ { "name": "357ed3e5-8b2e-4533-b6fe-3ea6e15b8de5", "desc": "Example description 1", "isCurrent": false, "id": "16cfdbb8-559c-49ff-8162-0a4c57079c81", "createdAt": "2022-04-02", "updatedAt": "2022-04-02", "owner": "[email protected]", "organizationId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd", "orgId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd", "_links": { "self": { "href": "/iaas/api/block-devices/e1cbc8e1-76bb-4bef-8e51-a582437266c2/snapshots/16cfdbb8-559c-49ff-8162-0a4c57079c81" } } }, { "name": "b04f7513-c695-4662-b5e8-a023a7b1bfe7", "desc": "Example description 2", "isCurrent": true, "id": "ed1b09ff-1175-4cdd-b07e-7bb906a9ddc4", "createdAt": "2022-04-02", "updatedAt": "2022-04-02", "owner": "[email protected]", "organizationId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd", "orgId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd", "_links": { "self": { "href": "/iaas/api/block-devices/e1cbc8e1-76bb-4bef-8e51-a582437266c2/snapshots/ed1b09ff-1175-4cdd-b07e-7bb906a9ddc4" } } } ]
Assign a snapshot ID variable.
snapshot_id='16cfdbb8-559c-49ff-8162-0a4c57079c81'
List information about the snapshot.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots/$snapshot_id?apiVersion=$api_version | jq "."
The response shows information about the single snapshot.
{ "name": "357ed3e5-8b2e-4533-b6fe-3ea6e15b8de5", "desc": "Example description 1", "isCurrent": false, "id": "16cfdbb8-559c-49ff-8162-0a4c57079c81", "createdAt": "2022-04-02", "updatedAt": "2022-04-02", "owner": "[email protected]", "organizationId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd", "orgId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd", "_links": { "self": { "href": "/iaas/api/block-devices/e1cbc8e1-76bb-4bef-8e51-a582437266c2/snapshots/16cfdbb8-559c-49ff-8162-0a4c57079c81" } }
Revert the FCD to the snapshot.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots/$snapshot_id?apiVersion=$api_version | jq "."
To validate the reversion, list information about the snapshot again.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots/$snapshot_id?apiVersion=$api_version | jq "."
In the response, "isCurrent":true
shows that the FCD has reverted to the snapshot.
{ "name": "357ed3e5-8b2e-4533-b6fe-3ea6e15b8de5", "desc": "Example description 1", "isCurrent": true, "id": "16cfdbb8-559c-49ff-8162-0a4c57079c81", "createdAt": "2022-04-02", "updatedAt": "2022-04-02", "owner": "[email protected]", "organizationId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd", "orgId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd", "_links": { "self": { "href": "/iaas/api/block-devices/e1cbc8e1-76bb-4bef-8e51-a582437266c2/snapshots/16cfdbb8-559c-49ff-8162-0a4c57079c81" } }