[Users] Regarding Python script for RHEVM

Hello , I am having a Rhel6.2 machine over tht i have installed ovirt-sdk using following command : $ git clone http://gerrit.ovirt.org/ovirt-engine-sdk $ yum install -y rpm-build python-devel python-setuptools $ make rpm $ yum localinstall rpmtop/RPMS/noarch/ovirt-engine-sdk-x.y-z.noarch.rpm thn i have written python script rhevmtest.py : from ovirtsdk.api import API from ovirtsdk.xml import params import time rhevm_uri = "https://rhevm301.vmm.hp.com:8443/api" rhevm_username = "admin@rhevm301.vmm.hp.com" rhevm_password = "iso*help" rhevmAPI = API(url=rhevm_uri, username=rhevm_username, password=rhevm_password) print "Connected to RHEVM Successful" instances = rhevmAPI.vms.list() cluster = rhevmAPI.clusters.get(name='Default') template = rhevmAPI.templates.get(name='CentOS') param = params.VM(name= 'test_vm' ,cluster=cluster,template=template,memory=2147483648) vm6 = rhevmAPI.vms.add(param) and its working fine :) Now can give me some guidance to write script for following functions: • pause (Pause a running vm) • Unpause (UnPause a vm) • start (start a vm from shutdown state) • shutdown (shutdown a vm) • stop (Poweroff the vm) *. * snapshot/ create template (take snapshot of a vm) • live-migration (Migrates a running vm to a new machine) • resize (Resize a vm) • resize-confirm (Confirm a previous vm) • resize-revert Revert a previous resize (and return to the previousVM) Regards, Romil Gupta

----- Original Message -----
From: "Romil Gupta" <romilgupta19@gmail.com> To: users@ovirt.org, mburns@redhat.com Sent: Monday, October 22, 2012 5:39:22 PM Subject: [Users] Regarding Python script for RHEVM
Hello ,
I am having a Rhel6.2 machine over tht i have installed ovirt-sdk using following command :
$ git clone http :// gerrit.ovirt.org/ovirt-engine-sdk $ yum install -y rpm-build python-devel python-setuptools $ make rpm $ yum localinstall rpmtop/RPMS/noarch/ovirt-engine-sdk-x.y-z.noarch.rpm
thn i have written python script rhevmtest.py :
from ovirtsdk.api import API from ovirtsdk.xml import params import time
rhevm_uri = " https://rhevm301.vmm.hp.com:8443/api " rhevm_username = " admin@rhevm301.vmm.hp.com " rhevm_password = "iso*help"
rhevmAPI = API(url=rhevm_uri, username=rhevm_username, password=rhevm_password)
print "Connected to RHEVM Successful"
instances = rhevmAPI.vms.list()
cluster = rhevmAPI.clusters.get(name='Default')
template = rhevmAPI.templates.get(name='CentOS')
param = params.VM(name= 'test_vm' ,cluster=cluster,template=template,memory=2147483648) vm6 = rhevmAPI.vms.add(param)
and its working fine :)
Now can give me some guidance to write script for following functions:
• pause (Pause a running vm)
• Unpause (UnPause a vm)
• start (start a vm from shutdown state)
• shutdown (shutdown a vm)
• stop (Poweroff the vm)
. snapshot/ create template (take snapshot of a vm)
• live-migration (Migrates a running vm to a new machine)
• resize (Resize a vm)
• resize-confirm (Confirm a previous vm)
• resize-revert Revert a previous resize (and return to the previousVM)
Hi Romil Please refer to this wiki http://wiki.ovirt.org/wiki/Testing/PythonApi It has some examples covering your questions. Eli
Regards, Romil Gupta
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
participants (2)
-
Eli Mesika
-
Romil Gupta