ovirt-ansible-collection icon indicating copy to clipboard operation
ovirt-ansible-collection copied to clipboard

[RFE] New role for VM backups using Incremental Backup API

Open sstagnaro opened this issue 2 years ago • 5 comments

SUMMARY

Currently, backup operations are not covered by neither oVirt Ansible modules nor roles. With a comprehensive new role, one can address all backups operations directly through Ansible/AWX workflows without the need of an external third-party solution.

COMPONENT NAME

Role could be named vm_backup

ADDITIONAL INFORMATION

The role should implement all the features provided by the new Incremental Backup API:

  • Perform full or incremental backups for disks using QCOW2 format without any temporary snapshots
  • Backup raw guest data instead copying QCOW2 data for QCOW2 disks
  • Restore raw guest data to disk onto raw or QCOW2 disks

sstagnaro avatar Aug 17 '21 17:08 sstagnaro

cc @mwperina @shenitzky

mnecas avatar Aug 18 '21 06:08 mnecas

@ahadas @nirs @bennyz something storage team can help with?

sandrobonazzola avatar Mar 18 '22 07:03 sandrobonazzola

The current backup_vm.py example in ovirt python sdk does most of the work: https://github.com/oVirt/python-ovirt-engine-sdk4/blob/main/examples/backup_vm.py

Example command line for full backup:

./backup_vm.py -c {conf} full --backup-dir backups/{vm-id} {vm-id}

This creates full backup of all disks and store the backups in:

backups/{vm-id}/timestamp.checkpoint-id.disk-id.full.qcow2

Example command for creating incremental backup:

./backup_vm.py -c {conf} incremental --backup-dir backups/{vm-id} \
    --from-checkpoint-uuid {checkpoint-id} {vm-id}

This create incremental backup of all disks, and store the backups in:

backups/{vm-id}/timestamp.checkpoint-id.disk-id.incremental.qcow2

If the previous backup file for {checkopint-id} exists, the backup file is used as the backing file of the incremental backup.

The backup disks can be restored using the upload_disk.py script:

./upload_disk.py -c {conf} --sd-name {storage-domain-name} \
    backups/{vm-id}/timestamp.checkpoint-id.disk-id.incremental.qcow2

This create a new disk with the contents of disk-id at the time of the incremental backup.

These examples do not backup the vm configuration, so they cannot restore the vm, only the disks. More work is needed to get the vm configuration, store it with the backups, prepare the configuration for restoring vm, and create a new vm from the configuration and uploaded disks.

There are open issues like how the restored vm should replace the previous vm, and how to avoid conflicts, like having same mac address in both vms.

For backing up and restoring the vm configuration we will need contribution from the virt team.

In general the idea that you can replace a backup application with ansible is questionable. Creating a basic solution that can backup and restore one vm requires more work and I'm not sure who will have time to work on it.

I think a better approach would be to integrate with existing open source backup systems like:

  • https://www.bareos.com/
  • https://www.borgbackup.org/

But I understand the desire to have a simple and easy to use backup solution. Since such solution is complicated, I don't think this repo is the right place to work on such solution. An ansible solution should be a thin wrapper around a tool or python library implementing the solution.

nirs avatar Mar 19 '22 00:03 nirs

In general the idea that you can replace a backup application with ansible is questionable. Creating a basic solution that can backup and restore one vm requires more work and I'm not sure who will have time to work on it.

I think a better approach would be to integrate with existing open source backup systems like:

  • https://www.bareos.com/
  • https://www.borgbackup.org/

+1 The idea was to have a backup application or scripts like the one Nir mentioned above to execute backup & restore, implementing it in Ansible is out of scope. However, we'd appreciate external contributions for this and assist with reviews if there's interest in that.

ahadas avatar Nov 13 '22 12:11 ahadas

+1 - would like to see this feature.

Bobba-star avatar May 05 '23 07:05 Bobba-star