[ovirt-users] async vm start (python)
Juan Hernandez
jhernand at redhat.com
Tue Oct 14 14:53:47 UTC 2014
On 10/14/2014 01:04 PM, Giulio Casella wrote:
> Hi everybody,
> I'm trying to start a VM (using python sdk) asynchronously, but I obtain
> synchronous behaviour.
> The engine is RHEV-M version 3.4.1-0.31.el6ev.
> Here a snippet of code:
>
> ---------------------------------------------------------
> myvm = api.vms.get(name="VMNAME")
> retval = myvm.start(params.Action(async=True))
> print ParseHelper.toXml(retval)
> ---------------------------------------------------------
>
> and this is what I get (retval):
>
> ---------------------------------------------------------
> <action>
> <async>true</async>
> <vm href="/api/vms/5aa66e96-5fdd-4562-9c7d-ae6f88e6805d"
> id="5aa66e96-5fdd-4562-9c7d-ae6f88e6805d">
> [...cut..]
> </vm>
> <job href="/api/jobs/5c2326c7-f25c-432f-8848-c94e80dd173b"
> id="5c2326c7-f25c-432f-8848-c94e80dd173b"/>
> <status>
> <state>complete</state>
> </status>
> </action>
> ---------------------------------------------------------
>
> status of task is always "complete" and the operation take some time,
> few seconds to some tens of seconds (sync behaviour).
>
> Any ideas?
>
> Thanks in advance,
> Giulio
>
The "async" parameter that you are passing to the REST API is only a
hint. It means that *if* the action performed by the backend has
associated async tasks then the REST API will not wait for them to
finish. In this particular case, the action performed by the backend
doesn't have async tasks, so the parameter is just ignored.
--
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
More information about the Users
mailing list