Backup rbd backed images to bareos or bacula.
Also there is a complementary python script that checks the bacula and opennebula python apis to check that all of your persistent VMs are being backed up.
Script to snapshot and export opennebula persistent VMs (image and optionally files from within the image using libguestfs) from a ceph datastore.
The backup server must have access to the opennebula controller and the ceph cluster.
It is assumed that
- image names are the same as the vm name
- backup user exists in opennebula
- ceph client authentication is working
- opennebula-tools is installed
- libguestfs is installed if file extraction is enabled
Inspired by http://opennebula.org/rentalia-experiences-with-opennebula-and-bacula/ which didn't quite fit the requirment.
Script should:
- snapshot the VM
- export the snapshot to disk
- delete the snapshot
- extract the files within the image (if using -f)
- output the image/files path to backup to bareos/bacula for backup to tape/disk/whatever
Tested using Bareos, sample config:
Job {
Name = "Backup_VM_grumpy"
JobDefs = "Weekly"
FileSet = "VM_grumpy"
Schedule = "Weekly"
ClientRunAfterJob = "/usr/local/bin/removevm.sh grumpy"
}
FileSet {
Name = "VM_grumpy"
Include {
Options {
signature = MD5
sparse = Yes
mtimeonly = yes
}
File = "\\|/usr/local/bin/exportvm.sh -f -u 192.168.1.2 -i my-rbd-id -p my-rbd-pool grumpy"
}
}
Note: be sure to increase "Client Connect Wait" from the default of 1800 seconds if backing up large VMs