[ovirt-users] Re: oVirt Python SDK and monitor export as OVA task

2020-02-27 Thread Gianluca Cecchi
On Thu, Feb 27, 2020 at 5:29 PM Strahil Nikolov 
wrote:
[snip]

> >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.
>
> [snip]

>
> Hi Gianluca,
>
> Did you check:
> https://github.com/silverorange/ovirt_ansible_backup
>
>
> Best Regards,
> Strahil Nikolov
>

Yes Strahil, I did check. I also checked his review with improvements made
in collaboration with Martin and I also gave my feedback to Jayme on the
list.
But as you can notice from my words I left above, it doesn't apply to my
scenario.
I want to create a snapshot of the VM but not with all its disks, but only
with the boot one.
And this in my opinion is not feasible with Ansible ovirt modules.
Coming back to the subject of this thread, in his original playbook Jayme
tests when the export file passes from ova.tmp extension to .ova and uses
that in his wait_for module to consider the job as completed.
My alternate proposal was to query the "job" table of the engine database
to check when the related job status becomes "FINISHED".
Probably I have to start from the poll_events.py sdk example to check when
I get the event that the export as ova has finished.
Any hint or alternate way through the python SDK will be appreciated.

Gianluca
___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@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/5VDIGFUYQQKQA52AH52CKMBKFPFRVN3T/


[ovirt-users] Re: oVirt Python SDK and monitor export as OVA task

2020-02-27 Thread Strahil Nikolov
On February 27, 2020 5:32:15 PM GMT+02:00, Gianluca Cecchi 
 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

Hi Gianluca,

Did you check:
https://github.com/silverorange/ovirt_ansible_backup


Best Regards,
Strahil Nikolov
___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@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/647WHAVH3DHDQYEHZW7K55M3LVACJ72X/


[ovirt-users] Re: oVirt Python SDK and monitor export as OVA task

2020-02-27 Thread Jayme
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 
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-le...@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/
>
___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@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/RL3BU5JXG4IN4XRJU3XFRMVGQFK7VIFY/