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@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@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_o...
this is your one
http://users.ovirt.narkive.com/Z29BQWAD/ovirt-users-python-sdk-attach-dis...
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