Thanks Juan,
this clearify a lot of things. So starting a VM is always a synchronous
task in the backend, isn't it?
But in some condition (heavy load of hypervisors) this task takes long
time (up to 20/30 seconds), not really suitable for sync tasks.
Maybe I should submit a feature request...
Ciao,
gc
Il 14/10/2014 16:53, Juan Hernandez ha scritto:
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.
--
Giulio Casella giulio at di.unimi.it
System and network manager
Computer Science Dept. - University of Milano