On Sun, Apr 10, 2016 at 1:16 PM, Yaniv Kaul <[email protected]> wrote: > > > On Sun, Apr 10, 2016 at 11:02 AM, Yedidyah Bar David <[email protected]> > wrote: >> >> On Sun, Apr 10, 2016 at 10:43 AM, Barak Korren <[email protected]> wrote: >> > Hi there, I use the following Python SDK snippet to create a template >> > from an existing VM: >> > >> > templ = ovirt.templates.add( >> > ovirtsdk.xml.Template(vm=vm, name=vm.name) >> > ) >> > >> > This seems to launch a template creation task in a non-blocking >> > manner, which makes the next command I run, which tries to delete the >> > VM, fail because the VM is still locked by the template creation task. >> > >> > Is there a way to block on the template creation task and not return >> > to the code until it finishes? >> >> I don't think so, but you can loop waiting, see e.g.: >> >> http://www.ovirt.org/develop/api/pythonapi/#create-a-template-from-vm > > > I wish we could have an extra parameters on the Python SDK that would do > this exact loop for us, since essentially most use cases require this. > I'm not sure it is relevant only for template creation, btw. > What is also more annoying, is that this loop (IIRC) will never break, if > something bad happens and the template ends up in a state != down (such as > locked). > (Same issue I've just had with host installation - Iv'e waited endlessly for > it to be in 'up' state, only to find out it ended in 'installed_failed' > state).
What we need is way to wait for events. For example, perform a request that never completes, sending events as json/xml fragments and chunked encoding. Here is an example: https://dev.twitter.com/streaming/overview Nir _______________________________________________ Users mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/users

