[ovirt-users] schedule a VM backup in ovirt 3.5

Yedidyah Bar David didi at redhat.com
Sun Oct 25 07:56:19 UTC 2015


On Fri, Oct 23, 2015 at 6:46 AM, Indunil Jayasooriya
<indunil75 at gmail.com> wrote:
>
>
>
>>
>> If you know the name of the VM then you can find it, including its id,
>> doing a search:
>>
>> https://engine.example.com/ovirt-engine/api/vms?search=name%3Dmyvm
>
>
>   Thanks for the above info. It worked.
>
>>
>>
>> If you prefer to use a script, which is probably the right thing, then
>> you can do something like this, using the Python SDK:
>>
>
> Can I shedule a VM backup with Ovirt Manager GUI. If possible, Pls let me
> know.

Not at this moment, and this is not planned for the future, afaik.

Did you play with the other SDK examples etc suggested during this thread?

May I suggest that this is best done as a plugin/contribution to a backup
solution, not standalone. I guess most sites with more than a few hosts use
some such solution - FOSS (amanda/bacula/backuppc/etc) or proprietary
(netbackup/backupexec/acronis/etc) - and backup of VMs (ovirt or other)
should be handled in this scope.

Searching the net I manage to find [1] and [2], which might be what
you want. Note that I never tried any of them myself.

[1] https://github.com/ovirt-china/vm-backup-scheduler
[2] https://github.com/wefixit-AT/oVirtBackup

Best,

>
>
>>
>> ---8<---
>> #!/usr/bin/python
>>
>> from ovirtsdk.api import API
>> from ovirtsdk.xml import params
>>
>> # Connect to the server:
>> api = API(
>>     url="https://engine.example.com/ovirt-engine/api",
>>     username="admin at internal",
>>     password="******",
>>     ca_file="/etc/pki/ovirt-engine/ca.pem",
>>     debug=False
>> )
>>
>> # Find the VM:
>> vm = api.vms.get(name="myvm")
>>
>> # Print the id:
>> print(vm.get_id())
>>
>> # Disconnect:
>> api.disconnect()
>> --->8---
>>
>
> Many thanks for the above script. I ran it on Ovirt manager. It worked. It
> gave me the ID of my CentOS_71 VM that I want to backup.
>
>
>
>>
>> Once you have the VM you can create a snapshot like this:
>>
>> ---8<---
>> vm.snapshots.add(
>>     params.Snapshot(description="My snapshot")
>> )
>> --->8---
>
>
> I rewrote the script in this way and ran it.
>
>
> #!/usr/bin/python
>
> from ovirtsdk.api import API
> from ovirtsdk.xml import params
>
> # Connect to the server:
> api = API(
>     url="https://engine.example.com/ovirt-engine/api",
>     username="admin at internal",
>     password="******",
>     ca_file="/etc/pki/ovirt-
>>
>> engine/ca.pem",
>>     debug=False
>> )
>>
>> # Find the VM:
>> vm = api.vms.get(name="myvm")
>>
>> # Print the id:
>> print(vm.get_id())
>>
>
>          vm.snapshots.add(
>          params.Snapshot(description="My snapshot")
>          )
>>
>> # Disconnect:
>> api.disconnect()
>
>
> No error was given. I have no idea whether snapshot wad added or NOT by the
> above script.
>
> I can't display it.
>
> How to display it?
>
> Then, How to backup the VM with this snaphot?
>
> Then, finally how to delete this snapshot? to delete the snapshot,
>
> I tried with below command. the did NOT worked.
>
>   vm.snapshots.delete()
>
> or
>   vm.snapshots.detach(
>
>  or
>   vm.snapshots.remove(
>
> I think I am have completed about 50% of this backup process. If you can
> write down the  above steps, It would be very grateful.
>
>
> I searched a whole lot. But , I still can't do it.
>
> These are the links I came across.
>
> https://github.com/laravot/backuprestoreapi/blob/master/example.py
>
> http://www.ovirt.org/Testing/PythonApi#Create_a_Basic_Environment_using_ovirt-engine-sdk
>
> this is your one
>
> http://users.ovirt.narkive.com/Z29BQWAD/ovirt-users-python-sdk-attach-disk-snapshot-to-another-virtual-machine
>
>
> Hmm,
>
> How to list the sanphot?
> how to backup the VM with snapshot?
> finally , how to remove this snapshot?
>
>
> Then. I think it will be OVER. Yesterday, I tried a lot.  but, NO success.
>
> Hope to hear from you.
>
>
>
>
>
>
>
>
>
>>
>> You can also use the Java SDK, if you prefer Java.
>>
>> --
>> Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
>> 3ºD, 28016 Madrid, Spain
>> Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
>
>
>
>
> --
> cat /etc/motd
>
> Thank you
> Indunil Jayasooriya
> http://www.theravadanet.net/
> http://www.siyabas.lk/sinhala_how_to_install.html   -  Download Sinhala
> Fonts
>
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>



-- 
Didi



More information about the Users mailing list