Hi, we at Rentalia.com have OpenNebula to meet our needs on virtualization, and we use Bacula to make backups of the vm’s disks. I’ll try to explain you how, let me tell you a bit of our environment first.
We have two OpenNebula environments, one’s for production and another for development. We use Puppet inside the vm’s so we don’t have to backup the files inside since they are given by Puppet. However, we have a few vm’s we would like to backup the disk image from, and since we are using Bacula along our system, we used Bacula to make this backups too.
First of all, we are using KVM and qcow2 drivers so we can make use of the “onevm disk-snapshot” capabilities, this way Bacula can invoke this command to make a hot snapshot of the disk. So the idea here its to let Bacula make a hot snapshot of the target disk, store it, and remove the copy. This is an example job we use:
As you can see, we use two scripts, which are on the frontend. One script for making the hot snapshot and tell Bacula where it was created, and another for cleaning it after Bacula store it .
If you used Bacula before this is pretty straightforward, maybe the File directive it’s the weird thing here, we are getting the output from a script instead of using a file or dir name.
And this is the main script we use, Prebackup.sh. We give it the name of a vm and it makes a hot snaphot of the target disk, wait for it to finish, and then output the path of the snapshot. Maybe its too simple and doesn’t meet your needs, since there are some lack of logic to decide which is the disk to make the snapshot, we use 0 on onevm disk-snapshot because all of our machines have the image we care on slot 0 but you could change the scripts. For example, with some grep magic you could check if the disk you are going to copy its persistent or not, and its worth make a backup of it.
There is some improvements that could be made on this method, the main script could be more intelligent to decide which image to backup and you have to keep some free space to make a room for the snapshot while doing the backup, but its some integration we made between Bacula and OpenNebula that works fine for us and maybe can help you too :)