[Users] Bug related to Rhevm/Ovirt auto update or refresh !!
Michael Pasternak
mpastern at redhat.com
Tue Nov 6 12:43:25 UTC 2012
Also i'd suggest using iso-uploader utility instead of manually copying files.
(you may not copy iso to the right directory or your file has wrong permissions)
On 11/06/2012 02:11 PM, Michael Pasternak wrote:
> On 11/06/2012 11:01 AM, Romil Gupta wrote:
>>
>> Hello,
>>
>> I upload ISO image using this script *upload.py*:
>>
>> ==================================================================================
>> import os
>>
>> os.system('mkdir mount_dir')
>>
>> os.system('mount -t nfs 15.15.158.2:/iso/rhevmisonfs mount_dir')
>>
>> print 'mounted'
>> print 'start copying'
>>
>> os.system('cp -f CentOS-6.2-x86_64-LiveDVD.iso mount_dir/e3e3b0cd-48a4-4bb8-a75b-07813f2c165e/images/11111111-1111-1111-1111-111111111111/')
>> print 'file copied'
>>
>> os.system('umount -a nfs 15.15.158.2:/iso/rhevmisonfs mount_dir')
>> print 'unmounted'
>>
>> os.system('rmdir mount_dir')
>> print 'dir removed'
>>
>> ==================================================================================
>>
>> and I created a *rhevm_test.py *
>>
>> 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')))
>> print 'VM created'
>>
>> domain=api.storagedomains.list()
>> for d in domain:
>> print ' domain name : %s ' %d.name <http://d.name>
>>
>> api.storagedomains.get(name='rhevmiso').update()
>>
>> rhevmiso=api.storagedomains.get(name='rhevmiso').files.list()
>> for iso in rhevmiso:
>> print ' iso --> %s \n' % iso.name <http://iso.name>
>>
>> image = api.storagedomains.get(name='rhevmiso').files.get(name=' CentOS-6.2-x86_64-LiveDVD.iso ')
>> print 'image found %s' %image
>>
>> api.vms.get(VM_NAME).cdroms.add(params.CdRom(name='cdrom',file=image))
>> print 'image added to VM'
>>
>> ==================================================================================
>>
>> now i got the following exception :
>> image found none
>>
>> *Note* : the reason is image is copied to "rhevmiso" storage domain but it not reflected in RHEVM user interface unless and untill I refresh it !
>> whenever listing files in api should force iso-refresh but its not working :(
>>
>> *Do we have any refresh or update function in ovirt sdk so that after coping the image RHEVM ISO domain will get refresh automatically ?? *
>
> no, listing files on storagedomian should do that.
>
--
Michael Pasternak
RedHat, ENG-Virtualization R&D
More information about the Users
mailing list