Gianluca,

This is not a direct solution to your problem, but for my project here: https://github.com/silverorange/ovirt_ansible_backup was recently updated to make use the ovirt_event_info Ansible module to determine the state of the export. I'm not sure how to do the same in python directly, but I'm sure it'd be possible. Unfortunately my solution is a full VM backup including all disks which I understand is not your goal here.

I have used vProtect in the past to backup VMs and it has the ability to specify which VM disks to include in the backup. That may be an option for you to explore.

- Jayme

On Thu, Feb 27, 2020 at 11:33 AM Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
Hello,
sometimes I have environments (typically with Oracle RDBMS on virtual machines) where there is one boot disk and one (often big, such as 500Gb or more) data disk.
The data disk has already its application backup (typically RMAN) and I want to complement it with a backup of only the boot disk of the operating system and VM configuration.
I'm almost done completing a script using oVirt Python SDK and sharing for comments.
I could be wrong, but I didn't find any ansible module  to do this with Ansible playbooks: I can only save all the VM, that in my case wouldn't be necessary and instead time and storage wasting.
The basic steps are:
- make a snapshot of the target vm, composed only by the boot disk
- clone the snapshot
- export the clone as OVA
- delete clone
- delete snapshot

There are some things to discuss about, probably when I will share the overall job (such as the name to give to the boot disk, if not using the bootable flag, the way to import the OVA in case of actual need, where you will have to comment out some fs entries related to missing disks, ecc.).
The only thing missing is how to monitor the export to ova task that, as with Ansible, it completes almost immediately, while the export is actually altready running.
I need to monitor it, so only at its real end I can run the last 2 steps of the above list of tasks.

Can you give me any hint? Not found very much in guide or docs on the web.
I'm currently using a sleep because my boot disk is about 20Gb in size and I know that in less than 2 minutes it normally completes.

The export as ova is very similar to what found in the examples and they don't contain a monitor for it but only the connection.close() call:

cloned_vm_service.export_to_path_on_host(
    host=types.Host(id=host.id),
    directory = export_as_ova_dir,
    filename = cloned_vm.name + '.ova'
)

Thanks in advance,
Gianluca

_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/66AFZIU4GTQRJSZR5F5P2OR6ZS6IBDP7/