[ovirt-users] schedule a VM backup in ovirt 3.5
Indunil Jayasooriya
indunil75 at gmail.com
Fri Oct 23 03:46:20 UTC 2015
> 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.
> ---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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20151023/754eb528/attachment-0001.html>
More information about the Users
mailing list