<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">&lt;<a href="mailto:didi@redhat.com" target="_blank">didi@redhat.com</a>&gt;</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 &lt;<a href="mailto:bkorren@redhat.com">bkorren@redhat.com</a>&gt; wrote:<br>
&gt; Hi there, I use the following Python SDK snippet to create a template<br>
&gt; from an existing VM:<br>
&gt;<br>
&gt;     templ = ovirt.templates.add(<br>
&gt;         ovirtsdk.xml.Template(vm=vm, name=<a href="http://vm.name" rel="noreferrer" target="_blank">vm.name</a>)<br>
&gt;     )<br>
&gt;<br>
&gt; This seems to launch a template creation task in a non-blocking<br>
&gt; manner, which makes the next command I run, which tries to delete the<br>
&gt; VM, fail because the VM is still locked by the template creation task.<br>
&gt;<br>
&gt; Is there a way to block on the template creation task and not return<br>
&gt; to the code until it finishes?<br>
<br>
</span>I don&#39;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&#39;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&#39;ve just had with host installation - Iv&#39;e waited endlessly for it to be in &#39;up&#39; state, only to find out it ended in &#39;installed_failed&#39; 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>