<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 10, 2016 at 11:02 AM, Yedidyah Bar David <span dir="ltr"><<a href="mailto:didi@redhat.com" target="_blank">didi@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sun, Apr 10, 2016 at 10:43 AM, Barak Korren <<a href="mailto:bkorren@redhat.com">bkorren@redhat.com</a>> wrote:<br>
> Hi there, I use the following Python SDK snippet to create a template<br>
> from an existing VM:<br>
><br>
> templ = ovirt.templates.add(<br>
> ovirtsdk.xml.Template(vm=vm, name=<a href="http://vm.name" rel="noreferrer" target="_blank">vm.name</a>)<br>
> )<br>
><br>
> This seems to launch a template creation task in a non-blocking<br>
> manner, which makes the next command I run, which tries to delete the<br>
> VM, fail because the VM is still locked by the template creation task.<br>
><br>
> Is there a way to block on the template creation task and not return<br>
> to the code until it finishes?<br>
<br>
</span>I don't think so, but you can loop waiting, see e.g.:<br>
<br>
<a href="http://www.ovirt.org/develop/api/pythonapi/#create-a-template-from-vm" rel="noreferrer" target="_blank">http://www.ovirt.org/develop/api/pythonapi/#create-a-template-from-vm</a></blockquote><div><br></div><div>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.</div><div>I'm not sure it is relevant only for template creation, btw.</div><div>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).</div><div>(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).</div><div>Y.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<span class="HOEnZb"><font color="#888888">--<br>
Didi<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div></div>