<br clear="all"><div>Hello , <div><br></div><div>I am having a Rhel6.2 machine over tht i have installed ovirt-sdk using following command :</div><div><br></div><div>$ git clone http<span style="line-height:19.03333282470703px;font-size:13px;font-family:sans-serif">://<a href="http://gerrit.ovirt.org/ovirt-engine-sdk" target="_blank" style="color:rgb(17,85,204)">gerrit.ovirt.org/ovirt-engine-sdk</a></span></div>
<div><span style="line-height:19.03333282470703px;font-size:13px;font-family:sans-serif">$ </span><span style="background-color:rgb(249,249,249);line-height:1.1em">yum install -y rpm-build python-devel python-setuptools</span></div>
<div><span style="background-color:rgb(249,249,249);line-height:1.1em">$ </span><span style="background-color:rgb(249,249,249);line-height:1.1em">make rpm</span></div><div><span style="background-color:rgb(249,249,249);line-height:1.1em">$ </span><span style="background-color:rgb(249,249,249);line-height:1.1em">yum localinstall rpmtop/RPMS/noarch/ovirt-engine-sdk-x.y-z.noarch.rpm</span></div>
<div><span style="background-color:rgb(249,249,249);line-height:1.1em"><br></span></div><div><span style="background-color:rgb(249,249,249);line-height:1.1em"><br></span></div><div><span style="background-color:rgb(249,249,249);line-height:1.1em">thn i have written python script <font color="#3366ff">rhevmtest.py </font>:</span></div>
<div><span style="background-color:rgb(249,249,249);line-height:1.1em"><br></span></div><div><span style="background-color:rgb(249,249,249);line-height:1.1em"><br></span></div><div><span style="background-color:rgb(249,249,249)"><font face="arial, sans-serif"><div style="line-height:14.300000190734863px">
<font color="#3333ff">from ovirtsdk.api import API</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff">from ovirtsdk.xml import params</font></div><div style="line-height:14.300000190734863px">
<font color="#3333ff">import time</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></div><div style="line-height:14.300000190734863px"><font color="#3333ff">rhevm_uri = "<a href="https://rhevm301.vmm.hp.com:8443/api">https://rhevm301.vmm.hp.com:8443/api</a>"</font></div>
<div style="line-height:14.300000190734863px"><font color="#3333ff">rhevm_username = "<a href="mailto:admin@rhevm301.vmm.hp.com">admin@rhevm301.vmm.hp.com</a>"</font></div><div style="line-height:14.300000190734863px">
<font color="#3333ff">rhevm_password = "iso*help"</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></div><div style="line-height:14.300000190734863px"><font color="#3333ff"><br>
</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff">rhevmAPI = API(url=rhevm_uri, username=rhevm_username, password=rhevm_password)</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff"><br>
</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff">print "Connected to RHEVM Successful"</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></div>
<div style="line-height:14.300000190734863px"><font color="#3333ff">instances = rhevmAPI.vms.list()</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff"> </font></div><div style="line-height:14.300000190734863px">
<font color="#3333ff">cluster = rhevmAPI.clusters.get(name='Default')</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></div><div style="line-height:14.300000190734863px">
<font color="#3333ff">template = rhevmAPI.templates.get(name='CentOS')</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></div><div style="line-height:14.300000190734863px">
<font color="#3333ff">param = params.VM(name= 'test_vm' ,cluster=cluster,template=template,memory=2147483648)</font></div><div style="line-height:14.300000190734863px"><font color="#3333ff">vm6 = rhevmAPI.vms.add(param) </font></div>
<div style="line-height:14.300000190734863px;color:rgb(34,34,34)"><br></div><div style="line-height:14.300000190734863px;color:rgb(34,34,34)">and its working fine :)</div><div style="line-height:14.300000190734863px;color:rgb(34,34,34)">
<br></div><div style="line-height:14.300000190734863px">Now can give me some guidance to write script for following functions:</div><div style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></div><div>
<div><span style="line-height:14.300000190734863px"><font color="#3333ff">•<span class="Apple-tab-span" style="white-space:pre">        </span>pause (Pause a running vm)</font></span></div><div><span style="line-height:14.300000190734863px"><font color="#3333ff"><br>
</font></span></div><div><span style="line-height:14.300000190734863px"><font color="#3333ff">•<span class="Apple-tab-span" style="white-space:pre">        </span>Unpause (UnPause a vm)</font></span></div>
<div><span style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></span></div><div><span style="line-height:14.300000190734863px"><font color="#3333ff">•<span class="Apple-tab-span" style="white-space:pre">        </span>start (start a vm from shutdown state)</font></span></div>
<div><span style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></span></div><div><span style="line-height:14.300000190734863px"><font color="#3333ff">•<span class="Apple-tab-span" style="white-space:pre">        </span>shutdown (shutdown a vm)</font></span></div>
<div><span style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></span></div><div><span style="line-height:14.300000190734863px"><font color="#3333ff">•<span class="Apple-tab-span" style="white-space:pre">        </span>stop (Poweroff the vm)</font></span></div>
<div><span style="line-height:14.300000190734863px"><font color="#3333ff"><br></font></span></div><div><span style="line-height:14.300000190734863px"><font color="#3333ff"><b><font size="4">. </font></b> snapshot/ create template (take snapshot of a vm)</font></span></div>
<div><span style="line-height:14.300000190734863px"><font color="#3333ff"> </font></span></div><div><span style="line-height:14.300000190734863px"><font color="#3333ff"><div>•<span class="Apple-tab-span" style="white-space:pre">        </span>live-migration (Migrates a running vm to a new machine)</div>
<div><br></div><div>•<span class="Apple-tab-span" style="white-space:pre">        </span>resize (Resize a vm)</div><div><br></div><div>•<span class="Apple-tab-span" style="white-space:pre">        </span>resize-confirm (Confirm a previous vm)</div>
<div><br></div><div>•<span class="Apple-tab-span" style="white-space:pre">        </span>resize-revert Revert a previous resize (and return to the previousVM)</div></font></span></div><div><span style="line-height:14.300000190734863px"><font color="#663366"><br>
</font></span></div><div><font color="#222222"><span style="line-height:14.300000190734863px"><br></span></font></div><div><font color="#222222"><span style="line-height:14.300000190734863px"><br></span></font></div><div>
<font color="#222222"><span style="line-height:14.300000190734863px">Regards,</span></font></div><div><span style="line-height:14.300000190734863px;color:rgb(34,34,34)">Romil Gupta</span></div><div><font color="#222222"><span style="line-height:14.300000190734863px"><br>
</span></font></div><div><font color="#222222"><span style="line-height:14.300000190734863px"><br></span></font></div><div><font color="#222222"><span style="line-height:14.300000190734863px"><br></span></font></div><div>
<font color="#222222"><span style="line-height:14.300000190734863px"><br></span></font></div><div><br></div></div><div style="line-height:14.300000190734863px;color:rgb(34,34,34)"><br></div></font></span></div></div>