[Engine-devel] Fwd: [Users] Related to python script for Attach Cd (.iso) to a vm

Michael Pasternak mpastern at redhat.com
Mon Nov 5 14:47:58 UTC 2012


On 11/05/2012 04:22 PM, Romil Gupta wrote:
> HI,
> I already tried this :
> 
> api.storagedomains.get(name='rhevmiso').update()
>     print 'updated'
>     rhevmiso=api.storagedomains.get(name='rhevmiso').files.list()
>     for iso  in rhevmiso:
>         print ' iso --> %s \n' % iso
>     image =  api.storagedomains.get(name='rhevmiso').files.get(name='tinycore.iso')
>     print 'image found %s' %image
>     try:
>         api.vms.get(VM_NAME).cdroms.add(params.CdRom(name='cdrom',file=image))
>         print 'image added to VM'
>     except Exception as e:
>         print 'Failed to add image \n%s' % str(e)
> 
> 
> But ,*it will not show the latest image that I have copied to 'rhevmiso' storage domain i.e tinycore.iso*
> 
> and o/p  is : 
> image found none
> Failed to add image \n%s' % str(e)
> 
> 
> Please help me !!

listing files in api should force iso-refresh [1],
make sure your iso-upload is succeeded and your iso
file has right permissions,

if it's not the case, it's sounds like a bug, please
file ovirt-engine bug on this.

[1] queryParams.setForceRefresh(true);

> 
> 
> Regards
> Romil
> 
> 
> On Mon, Nov 5, 2012 at 7:34 PM, Michael Pasternak <mpastern at redhat.com <mailto:mpastern at redhat.com>> wrote:
> 
>     On 11/05/2012 01:23 PM, Romil Gupta wrote:
>     >
>     > On 11/05/2012 09:58 AM, Romil Gupta wrote:
>     >>  Do we have any refresh or update function in ovirt sdk  so that after coping the image  RHEVM will get refresh automatically ??
>     >>
>     >> Regards,
>     >> Romil
>     >
>     > yes, just do GET on /api/storagedomains/xxx/files
>     > --
>     >
>     > Michael Pasternak
>     > RedHat, ENG-Virtualization R&D
>     >
>     >
>     > Hi,
>     >
>     > I have to write a python script  using ovirt sdk !
>     > Please tell me the refresh iso domain function in python :)
> 
>     sdk using very same semantics as apy does,
> 
>     sd = api.storagedomains.get(name="iso_domain")
>     sd.files.list() // will produce [GET on /api/storagedomains/xxx/files]
> 
> 
>     >
>     > Regards ,
>     > Romil
> 
> 
>     --
> 
>     Michael Pasternak
>     RedHat, ENG-Virtualization R&D
> 
> 
> 
> 
> -- 
> I don't wish to be everything to everyone, but I would like to be something to someone.


-- 

Michael Pasternak
RedHat, ENG-Virtualization R&D



More information about the Devel mailing list