Manage First Class Disk Snapshots
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.
- Verify that all general prerequisites and prerequisites for theAutomation AssemblerInfrastructure 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.
- Assign the block device ID variable.block_device_id='<your_block_device_id>'
- 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" }' | jq "."The response includes a selfLink value.{ "progress": 0, "status": "INPROGRESS", "name": "Provisioning", "id": "example-selfLink-alphanumeric-string", "selfLink": "/iaas/api/request-tracker/example-selfLink-alphanumeric-string" }
- Assign the selfLink variable.selfLink_id='example-selfLink-alphanumeric-string'
- Use the selfLink to track the progress of the FCD snapshot creation.curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version | jq "."The response indicates if the snapshot is successful.{ "progress": 100, "message": "success", "status": "FINISHED", "resources": [ "/iaas/api/block-devices/your-block-device-id" ], ... }
- To create additional FCD snapshots, repeat #GUID-CC4FAC80-584C-4B25-AD62-1FFE8809E2F9_STEP_722CF989-37EC-4969-B983-DD1C27E56201-en to #GUID-CC4FAC80-584C-4B25-AD62-1FFE8809E2F9_STEP_2CDEF3CD-C103-4D45-8C84-F00F01E5089F-en.
- To get a snapshot ID, list all FCD snapshots.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 "."If you created multiple snapshots, the response lists multiple snapshot IDs.
- Examine the response and select a snapshot ID to assign as a variable.snapshot_id=<your_snapshot_id_1>
- You can list an individual 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 "."
- You can revert an FCD to a snapshot.curl -X POST \ $url/iaas/api/block-devices/$block_device_id/operations/revert?id=$snapshot_id\&apiVersion=$api_version \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '' | jq "."To track the progress of the reversion, perform #GUID-CC4FAC80-584C-4B25-AD62-1FFE8809E2F9_STEP_533302B9-3B9A-4770-8D97-2C0E3968F5AE-en and #GUID-CC4FAC80-584C-4B25-AD62-1FFE8809E2F9_STEP_2CDEF3CD-C103-4D45-8C84-F00F01E5089F-en.
- You can delete a snapshot.curl -X DELETE -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 "."
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://appliance.domain.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": "user@mycompany.com", "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": "user@mycompany.com", "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": "user@mycompany.com", "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": "user@mycompany.com", "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" } }