Open sstagnaro opened 3 years ago
cc @mwperina @shenitzky
@ahadas @nirs @bennyz something storage team can help with?
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:
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.
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:
+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.
+1 - would like to see this feature.
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: