Manage Virtual Machine Backup/Restore Operation
APIs used for virtual machine backup/restore are revised and enhanced based on the cinder API in the OpenStack Community. The manage existing backup/restore APIs provides the capability to back up and restore virtual machines that are booted from an IBM® Storage Scale volume in a KVM host. The capabilities include listing all existing backups from a specific instance group, making a backup for an active status virtual machine, restoring the backup and deleting the backup operation.
Note The concept of an instance group is shown only in the IBM® Cloud Infrastructure
Center. A virtual machine that is deployed with a bootable volume creates a consistency group
automatically. To distinguish a
consistency group
concept from OpenStack, to generate a consistency group from a virtual machine is called an
instance group
.
Managing Virtual Machine Backup/Restore options
Table 1. Options for managing Backup/Restore API
| Method | URI | Description |
|---|---|---|
| GET | /v3/{project_id}/instance-groups/{group_id} | Listing all existing backups under the specific instance group. |
| POST | /v3/{project_id}/instance-groups/{group_id}/backup | Making a backup for an instance group. |
| PUT | /v3/{project_id}/instance-groups/{group_id}/restore | The restore operation. |
| PUT | /v3/{project_id}/instance-groups/{group_id}/delete_backup | Deleting the backup operation. |
| DELETE | /v3/{project_id}/instance-groups/{group_id} | Deleting the instance group operation. |
Listing all existing backups
The operation lists all existing backups on the specific instance group. This API needs to carry a parameter of the instance group ID in the URL. The API returns the list of backups on the instance group. The list includes the backup snapshot ID, instance group ID, project ID, user ID, backup name, backup description, backup status, group type list ID, detailed information of the backup and the created time from the backup.
Response Code
- Normal Response Code: OK (200)
- Error Response Code: Not Found (404), Bad Request (400)
Response Body
Table 2. Parameters in the response for listing all existing backups
| Name | Style | Type | Description |
|---|---|---|---|
| id | body | string | Group snapshot ID. |
| group_id | body | string | Instance group ID. |
| project_id | body | string | Current project ID from OpenStack command. |
| user_id | body | string | User ID from command
cinder
snapshot-list
. |
| name | body | string | Name of the backup. |
| description | body | string | Description of the current backup. |
| status | body | string | Status of the backup. |
| group_type_id | body | string | Group_type_id comes from the command
cinder
group-type-list
with corresponding column
instance_group_type
. |
| backups | body | list | List of detailed information with the backup. |
| created_at | body | string | Created time of the backup. |
Example:
[
{ "id"="43fdfa2d-...",
"group_id"="b9604273-...",
"project_id"="18ab1...",
"user_id"="c9be5...",
"name"="backup1",
"description"="group backup for instance 85scsi3_backup",
"status"="available",
"group_type_id"="ef1322a1-...",
"backups"=[{"id": "7ab5017f-...",
"user_id": "c9be5...",
"project_id": "18ab1...",
"volume_id": "9314dbb9-...",
"availability_zone": 'null',
"container": "b9604273-...",
"parent_id": 'null',
"parent": 'null',
"status": "available",
"fail_reason": 'null',
"size": 10,
"display_name": "backup1",
"display_description": "backup for ...",
"service_metadata": "volume_9314dbb9-...",
"service": "cinder.backup.drivers.posix.PosixBackupDriver",
"object_count": 40,
"temp_volume_id": 'null',
"temp_snapshot_id": 'null',
"num_dependent_backups": 0,
"snapshot_id": "94fbda1e-...",
"data_timestamp": "2022-10-31 02:41:00",
"restore_volume_id": 'null',
"metadata": {
"instance_group_id": "b9604273-...1",
"group_snapshot_id": "43fdfa2d-...",
"instance_id": "f9c4d3b4-...",
"mountpoint": "/dev/vda"},
"encryption_key_id": 'null',
"created_at": "2022-10-31 02:41:05"}],
"created_at"="2022-10-31 02:41:00"}]
Having a backup with a virtual machine
The operation makes up the backup for a specific instance group. The URL needs to a carry project ID, the instance group ID as parameters. And the Body needs to carry the instance ID (server ID) and the name for the backup as parameters.
Request Parameters
{"instance_id":"f9c4d3b4-...", "name":"backup2"}
An optional request parameter "async":"true" can be added in the request body.
{"instance_id":"f9c4d3b4-...", "name":"backup2", "async":"true"}
Response Code
- Normal Response Code: Created (201)
- Error Response Code: Bad Request (400)
Response Body
Table 3. Parameters in the response for having a backup with a virtual machine
| Name | Style | Type | Description |
|---|---|---|---|
| operation | body | string | Name of the backup operation. |
| success | body | string | Result of the backup operation. |
| instance_id | body | string | The server name that is backed up. |
| group_id | body | string | The ID of the instance group. |
| group_snapshot_id | body | string | The ID of the group snapshot. |
| volume_id | body | string | The volume ID comes from the server that is backed up. |
| volume_snapshot_id | body | string | The volume snapshot ID comes from the volume snapshot that under the group snapshot. |
| backup_id | body | string | Backup ID comes from the command
cinder
backup-list
with corresponding backup name. |
Example:
{
"operation": "backup",
"success": true,
"instance_id": "f9c4d3b4-f1bc-405a-a210-29e44dd85385",
"group_id": "b9604273-6e94-4a8c-88b4-a994d101c841",
"group_snapshot_id": "9f49f851-f523-43e8-99de-e894541643bf",
"volume_id": [
"9314dbb9-f736-4a8b-b1dc-a056b0b1e88f"
],
"volume_snapshot_id": [
"c439cdc6-99db-4243-ba67-91227d75583e"
],
"backup_id": [
"8b07203f-6482-404d-bd28-e06be78b87fb"
]
}
Table 4. Parameters in the response for having a backup with a virtual machine in async process
| Name | Style | Type | Description |
|---|---|---|---|
| msg | body | string | Async information with backup operation. |
Example:
{
"msg": "Backup request submitted"
}
Restoring a virtual machine with specific backup
The restore operation can restore the data that comes from a specific backup. The URL needs to carry current project ID and the instance group ID as parameters. For the Body, you need to carry the instance ID, the group snapshot ID and the name of the backup as parameters. The API returns the operation name, status, instance ID, the instance group ID, the group snapshot ID, the backup ID that uses during the restoration and the volume ID that comes from the server.
Note
- The virtual machine needs to be in the shutdown status before the restore operation.
- The group snapshot needs to be in available status.
- The backup that is needed for restoration must be in an available status.
- Make sure that there is available space on disk to restore the virtual machine.
Request Parameters
{"instance_id":"f9c4d3b4-...", "group_snapshot_id":"9f49f851-...", "name":"backup2"}
An optional request parameter "async":"true" can be added in the request body.
{"instance_id":"f9c4d3b4-...", "group_snapshot_id":"9f49f851-...", "name":"backup2", "async":"true" }
Response Code
- Normal Response Code: Created (201)
- Error Response Code: Bad Request (400)
Response Body
Table 5. Parameters in the response for taking a restore with a virtual machine
| Name | Style | Type | Description |
|---|---|---|---|
| operation | body | string | The Name of restore operation. |
| success | body | string | Whether the operation is success or not. |
| instance_id | body | string | The ID of the virtual machine that taken the restoration process. |
| group_id | body | string | The ID of the instance group. |
| group_snapshot_id | body | string | The ID of the group snapshot. |
| backup_id | body | string | The ID of the backup that uses for restore. |
| volume_id | body | string | The volume ID comes from the server that is restored. |
Example:
{
"operation": "restore",
"success": true,
"instance_id": "f9c4d3b4-f1bc-405a-a210-29e44dd85385",
"group_id": "b9604273-6e94-4a8c-88b4-a994d101c841",
"group_snapshot_id": "9f49f851-f523-43e8-99de-e894541643bf",
"backup_id": [
"8b07203f-6482-404d-bd28-e06be78b87fb"
],
"volume_id": [
"9314dbb9-f736-4a8b-b1dc-a056b0b1e88f"
]
}
Table 6. Parameters in the response for taking a restore with a virtual machine in async process
| Name | Style | Type | Description |
|---|---|---|---|
| msg | body | string | Async information with restore operation. |
| Example: |
{
"msg": "Restore request submitted"
}
Deleting the backup of a virtual machine
The deletion operation can delete the backup from the virtual machine. The API returns the operation name, status, instance ID of the virtual machine, ID of the instance group, group snapshot ID and backup ID need to be deleted.
Request Parameters
{"instance_id":"0b359f71-...","group_snapshot_id":"56dbba73-...", "name":"del1"}
Response Code
- Normal Response Code: Created (201)
- Error Response Code: Not Found (404), Bad Request (400)
Response Body
Table 7. Parameters in the response for deleting the backup from the virtual machine
| Name | Style | Type | Description |
|---|---|---|---|
| operation | body | string | The name of delete backup operation. |
| success | body | string | Whether the delete backup operation is success. |
| instance_id | body | string | The ID of the virtual machine that taken the delete backup process. |
| group_id | body | string | The ID of the instance group. |
| group_snapshot_id | body | string | The id of the group snapshot. |
| backup_id | body | string | The id of the backup that uses for delete backup. |
Example:
{
"operation": "delete_backup",
"success": true,
"instance_id": "0b359f71-9af0-4345-94a6-7231b6a3d1f1",
"group_id": "b866ddd7-93ae-4e92-9745-d1dd2d8e3b1a",
"group_snapshot_id": "56dbba73-f5d6-432b-8afa-6b47396227de",
"backup_id": [
"64f56c75-02dc-4f22-bbe9-fbd44d5b807e"
]
}
Deleting the instance group
Deleting the instance group operation does not delete the virtual machine or all volumes from the origin instance group. All volumes are removed out of the instance group, the instance group under the file system is deleted.
Note Existing backups on the virtual machine
can block the delete instance group operation. Delete all backups
manually or by using
delete the
backup
APIs that mentioned previously before the
deletion instance group operation.
Response Code
- Normal Response Code: OK (200)
- Error Response Code: Not Found (404), Bad Request (400)
There is no response body from the deleting the instance group operation. You can check on UI or the filesystem that instance group generated from.