<div><br></div><div class="gmail_quote"><span style="font-family:arial,sans-serif;font-size:13px">Hello, </span><br><div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
I upload ISO image using this script <b>upload.py</b>:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">==================================================================================<br>
</div><div style="font-family:arial,sans-serif;font-size:13px"><div><font color="#0000ff">import os</font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">os.system('mkdir mount_dir')<br>
</font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">os.system('mount -t nfs 15.15.158.2:/iso/rhevmisonfs mount_dir')</font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">print 'mounted'<br>
</font></div><div><font color="#0000ff">print 'start copying'</font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">os.system('cp -f CentOS-6.2-x86_64-LiveDVD.iso mount_dir/e3e3b0cd-48a4-4bb8-a75b-07813f2c165e/images/11111111-1111-1111-1111-111111111111/')<br>
</font></div><div><font color="#0000ff">print 'file copied'<br></font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">os.system('umount -a nfs 15.15.158.2:/iso/rhevmisonfs mount_dir')<br>
</font></div><div><span style="color:rgb(0,0,255)">print 'unmounted'</span><br></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">os.system('rmdir mount_dir')</font></div><div><font color="#0000ff">print 'dir removed'</font></div>
</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">==================================================================================</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">and I created a <b>rhevm_test.py </b></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
<font color="#0000ff">api.vms.add(params.VM(name=VM_NAME, memory=2*GB,os=params.OperatingSystem(boot=[params.Boot(dev='cdrom'), params.Boot(dev='hd')]),cluster=api.clusters.get(name='Default'), template=api.templates.get('Blank')))<br>
</font></div><div style="font-family:arial,sans-serif;font-size:13px"><div><font color="#0000ff"> print 'VM created'</font></div><div><font color="#0000ff"> </font></div><div><font color="#0000ff">domain=api.storagedomains.list()</font></div>
<div><font color="#0000ff"> for d in domain:</font></div><div><font color="#0000ff"> print ' domain name : %s ' %<a href="http://d.name">d.name</a></font></div><div><div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">api.storagedomains.get(name='rhevmiso').update()</font></div></div><div><br></div><div><font color="#0000ff">rhevmiso=api.storagedomains.get(name='rhevmiso').files.list()</font></div>
<div><font color="#0000ff"> for iso in rhevmiso:</font></div><div><font color="#0000ff"> print ' iso --> %s \n' % <a href="http://iso.name">iso.name</a></font></div><div><font color="#0000ff"> </font></div>
<div><font color="#0000ff">image = api.storagedomains.get(name='rhevmiso').files.get(name=' </font><span style="color:rgb(0,0,255)">CentOS-6.2-x86_64-LiveDVD.iso </span><font color="#0000ff">')</font></div>
<div><font color="#0000ff"> print 'image found %s' %image</font></div></div><div style="font-family:arial,sans-serif;font-size:13px"><font color="#0000ff"><br></font></div><div style="font-family:arial,sans-serif;font-size:13px">
<font color="#0000ff">api.vms.get(VM_NAME).cdroms.add(params.CdRom(name='cdrom',file=image))<br></font></div><div style="font-family:arial,sans-serif;font-size:13px"><font color="#0000ff"> print 'image added to VM'</font></div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">==================================================================================<br></div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">now i got the following exception : </div><div style="font-family:arial,sans-serif;font-size:13px"><font color="#ff0000">image found none </font></div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px"><b>Note</b> : the reason is image is copied to "rhevmiso" storage domain but it not reflected in RHEVM user interface unless and untill I refresh it !</div>
<div style="font-family:arial,sans-serif;font-size:13px">whenever listing files in api should force iso-refresh but its not working :(</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif">
<font><b>Do we have any refresh or update function in ovirt sdk so that after coping the image RHEVM ISO domain will get refresh automatically ?? </b></font><br></div><div style="font-family:arial,sans-serif;font-size:13px">
<font size="4"><br></font></div><div style="font-family:arial,sans-serif"><font>With Regards,</font></div><div style="font-family:arial,sans-serif">Romil<br></div></div><br></div><br><br clear="all"><div><br></div><br>