<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Let’s preface this with Glance being the part of OpenStack I am least familiar with. Keep in mind my commentary is related to the idea that the asynchronous tasks as designed are being considered beyond Glance. The problems of image upload/import/cloning/export are unlike other OpenStack operations for the most part in that they involve binary data as the core piece of the payload.</div><div><br></div><div>Having said that, I’d prefer a polymorphic POST to the tasks API as designed. But I’m much more concerned with the application of the tasks API as designed to wider problems.</div><div><br></div>Basically, I’d stick with POST /images.<div><br></div><div>The content type should indicate what the server should expect. Basically, the content can be:</div><div><br></div><div>* An actual image to upload</div><div>* Content describing a target for an import</div><div>* Content describing a target for a clone operation</div><div><br></div><div>Implementation needs dictate whether any given operation is synchronous or asynchronous. Practically speaking, upload would be synchronous with the other two being asynchronous. This would NOT impact an existing /images POST as it will not change (unless we suddenly made it asynchronous).</div><div><br></div><div>The response would be CREATED (synchronous) or ACCEPTED (asynchronous). If ACCEPTED, the body would contain JSON/XML describing the asynchronous task.</div><div><br></div><div>I’m not sure if export is supposed to export to a target object store or export to another OpenStack environment. But it would be an async operation either way and should work as described above. Whether the endpoint for the image to be exported is the target or just /images is something worthy of discussion based on what the actual function of the export is.</div><div><br></div><div>-George</div><div><br></div><div><div><div>On Nov 12, 2013, at 5:45 PM, John Bresnahan <<a href="mailto:john@bresnahan.me">john@bresnahan.me</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000">
George,<br>
<br>
Thanks for the comments, they make a lot of sense. There is a
Glance team meeting on Thursday where we would like to push a bit
further on this. Would you mind sending in a few more details?
Perhaps a sample of what your ideal layout would be? As an example,
how would you prefer actions are handled that do not effect a
currently existing resource but ultimately create a new resource
(for example the import action).<br>
<br>
Thanks!<br>
<br>
John<br>
<br>
<br>
<div class="moz-cite-prefix">On 11/11/13, 8:05 PM, George Reese
wrote:<br>
</div>
<blockquote cite="mid:950770F6-7FCF-451C-B0B1-C9D5D6105373@imaginary.com" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
I was asked at the OpenStack Summit to look at the Glance Tasks,
particularly as a general pattern for other asynchronous
operations.
<div><br>
</div>
<div>If I understand Glance Tasks appropriately, different
asynchronous operations get replaced by a single general purpose
API call?</div>
<div><br>
</div>
<div>In general, a unified API for task tracking across all kinds
of asynchronous operations is a good thing. However, assuming
this understanding is correct, I have two comments:</div>
<div><br>
</div>
<div>#1 A consumer of an API should not need to know a priori
whether a given operation is “asynchronous”. The asynchronous
nature of the operation should be determined through a response.
Specifically, if the client gets a 202 response, then it should
recognize that the action is asynchronous and expect a task in
the response. If it gets something else, then the action is
synchronous. This approach has the virtual of being proper HTTP
and allowing the needs of the implementation to dictate the
synchronous/asynchronous nature of the API call and not a fixed
contract.</div>
<div><br>
</div>
<div>#2 I really don’t like the idea of a single endpoint
(/v2/tasks) for executing all tasks for a particular OpenStack
component. Changes should be made through the resource being
impacted.</div>
<div><br>
</div>
<div>-George</div>
<div><br>
<div>
<div>
<div>--</div>
<div>George Reese (<a moz-do-not-send="true" href="mailto:george.reese@imaginary.com" target="_blank">george.reese@imaginary.com</a>)<br>
t: @GeorgeReese m: <a moz-do-not-send="true" href="tel:%2B1%28207%29956-0217" value="+12079560217" target="_blank">+1(207)956-0217</a> Skype:
nspollution</div>
</div>
<div><br>
</div>
<br class="Apple-interchange-newline">
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OpenStack-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
</blockquote>
<br>
</div>
_______________________________________________<br>OpenStack-dev mailing list<br><a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br></blockquote></div><br><div>
<div><div>--</div><div>George Reese (<a href="mailto:george.reese@imaginary.com" target="_blank">george.reese@imaginary.com</a>)<br>t: @GeorgeReese m: <a href="tel:%2B1%28207%29956-0217" value="+12079560217" target="_blank">+1(207)956-0217</a> Skype: nspollution</div></div><div><br></div><br class="Apple-interchange-newline">
</div>
<br></div></body></html>