Hi Youcef,<div><br></div><div>Thanks for the clarification. I was pretty sure this was well thought in the API design, as I wrote in my previous post :)</div><div><br></div><div>The naming for the attribute on the pool which references health_monitors is a discussion worth having. I have very little data points for comparison with other parts of Quantum and Openstack APIs. The only similar bit is probably the network-subnet relationship. In the response for a GET /networks/<network-id> a list of subnet identifiers is returned. The name for the list attribute is just 'subnets'. However, as this is a read-only attribute there is no need for handling it as a sub-resource. Response sample is available at [1]</div>
<div><br></div><div>Between handling the collection of health monitor references as a sub-resource and having member actions for CRUD operations, I prefer the first solution. I am happy to offer any kind of supports for the relevant changes in the apiv2 modules. The other option is to regard health_monitors as a 'list' attribute. Which means that a POST/PUT will create/update the whole list. This is practical from server-side perspective, but has also drawbacks. Indeed it adds burden to the client; for instance, in order to add an element to the list you'll need a GET and then a PUT; and it also causes confusion because of the fact that our PUT actually implement patch semantics.</div>
<div><br></div><div>Salvatore</div><div><br></div><div>[1] <a href="http://docs.openstack.org/api/openstack-network/2.0/content/List_Networks_Detail.html#d6e858">http://docs.openstack.org/api/openstack-network/2.0/content/List_Networks_Detail.html#d6e858</a><br>
<div class="gmail_quote"><br></div><div class="gmail_quote">On 16 November 2012 18:04, Youcef Laribi <span dir="ltr"><<a href="mailto:Youcef.Laribi@eu.citrix.com" target="_blank">Youcef.Laribi@eu.citrix.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Changing the subject line…<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Health monitors “</span><span lang="EN" style="font-size:11.0pt;font-family:Courier">/health_monitors/</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">” are a top resource in the API and are retrieved/added/removed/updated through their CRUD operations on this top resource.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The subresource “</span><span lang="EN" style="font-size:11.0pt;font-family:Courier">/pools/{pool_id}/health_monitors</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">“ is used for associating already existing health monitors (created above) with an existing pool, or for retrieving the health monitors associated with a pool. It is a collection (list) that only contain IDs of health monitors not the health monitors themselves. We can call this resource “</span><span lang="EN" style="font-size:11.0pt;font-family:Courier">/pools/{pool_id}/health_monitor_references</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">“ or “</span><span lang="EN" style="font-size:11.0pt;font-family:Courier">/pools/{pool_id}/pool_health_monitors</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">” if we like, but I felt this was ugly and I think there is no issue or ambiguity in the definition of API itself as all operations are clearly described. But if you think changing its name helps, I can do that </span><span style="font-size:11.0pt;font-family:Wingdings;color:#1f497d">J</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> Would like to hear what others in the team think.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Youcef<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Oleg Bondarev [mailto:<a href="mailto:obondarev@mirantis.com" target="_blank">obondarev@mirantis.com</a>] <br>
<b>Sent:</b> Friday, November 16, 2012 1:12 AM<br><b>To:</b> Youcef Laribi; 'OpenStack Development Mailing List'<br><b>Subject:</b> RE: [openstack-dev] [quantum] Quantum extension framework issue<u></u><u></u></span></p>
</div></div><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi guys,<u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I just want to clarify some things regarding health monitors in LBaaS API: actually it is not completely a sub-resource of pool objects. <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">According to the API it is a separate resource which can be added/showed/updated/deleted (with GET/POST.. “/v1.0/health_monitors/..” rest calls) in order to be reusable in different pools and probably anywhere else as Sasha mentioned. Youcef please correct me if I am wrong here.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Speaking about sub-resources I think following rest call: <u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal" style="background:#f3f5f7"><span lang="EN" style="font-size:11.0pt;font-family:Courier">POST /v1.</span><span lang="EN" style="font-size:11.0pt;font-family:Courier;color:#0080c0">0</span><span lang="EN" style="font-size:11.0pt;font-family:Courier">/pools/{pool_id}/health_monitors<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">is intended to <b>create</b> a sub-resource of health monitor for the pool and not to <b>add</b> an existing health monitor to the pool.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Also I think having health monitors as a separate resource and as a sub-resource of a pool at the same time is not correct.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">So my vision is to leave health monitors as a separate resource and to use member actions for the purpose of getting/associating/disassociating health monitors with a pool:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Get health monitors of a pool:<u></u><u></u></span></p><p class="MsoNormal" style="background:#f3f5f7">
<span lang="EN" style="font-size:11.0pt;font-family:Courier">GET /v1.</span><span lang="EN" style="font-size:11.0pt;font-family:Courier;color:#0080c0">0</span><span lang="EN" style="font-size:11.0pt;font-family:Courier">/pools/{pool_id}/get_health_monitors<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Associate health monitors with a pool:<u></u><u></u></span></p><p class="MsoNormal" style="background:#f3f5f7">
<span lang="EN" style="font-size:11.0pt;font-family:Courier">PUT /v1.</span><span lang="EN" style="font-size:11.0pt;font-family:Courier;color:#0080c0">0</span><span lang="EN" style="font-size:11.0pt;font-family:Courier">/pools/{pool_id}/add_health_monitors<u></u><u></u></span></p>
<pre style="background:#f3f5f7"><span><span lang="EN" style="font-size:11.0pt;font-family:Courier">{</span></span><span lang="EN" style="font-size:11.0pt;font-family:Courier"><u></u><u></u></span></pre><pre style="background:#f3f5f7">
<span><span lang="EN" style="font-size:11.0pt;font-family:Courier"> </span></span><span><span lang="EN" style="font-size:11.0pt;font-family:Courier;color:#004080">"health_monitors"</span></span><span><span lang="EN" style="font-size:11.0pt;font-family:Courier"> : [</span></span><span lang="EN" style="font-size:11.0pt;font-family:Courier"><u></u><u></u></span></pre>
<pre style="background:#f3f5f7"><span><span lang="EN" style="font-size:11.0pt;font-family:Courier"> </span></span><span><span lang="EN" style="font-size:11.0pt;font-family:Courier;color:#004080">"f3eeab00-8367-4524-b662-55e64d4cacb5"</span></span><span lang="EN" style="font-size:11.0pt;font-family:Courier"><u></u><u></u></span></pre>
<pre style="background:#f3f5f7"><span><span lang="EN" style="font-size:11.0pt;font-family:Courier"> ]</span></span><span lang="EN" style="font-size:11.0pt;font-family:Courier"><u></u><u></u></span></pre>
<pre style="background:#f3f5f7"><span><span lang="EN" style="font-size:11.0pt;font-family:Courier">}</span><u></u><u></u></span></pre><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Disassociate health monitors from a pool:</span><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:#f3f5f7"><span lang="EN" style="font-size:11.0pt;font-family:Courier">PUT /v1.</span><span lang="EN" style="font-size:11.0pt;font-family:Courier;color:#0080c0">0</span><span lang="EN" style="font-size:11.0pt;font-family:Courier">/pools/{pool_id}/delete_health_monitors<u></u><u></u></span></p>
<pre style="background:#f3f5f7"><span><span lang="EN" style="font-size:11.0pt;font-family:Courier">{</span></span><span lang="EN" style="font-size:11.0pt;font-family:Courier"><u></u><u></u></span></pre><pre style="background:#f3f5f7">
<span><span lang="EN" style="font-size:11.0pt;font-family:Courier"> </span></span><span><span lang="EN" style="font-size:11.0pt;font-family:Courier;color:#004080">"health_monitors"</span></span><span><span lang="EN" style="font-size:11.0pt;font-family:Courier"> : [</span></span><span lang="EN" style="font-size:11.0pt;font-family:Courier"><u></u><u></u></span></pre>
<pre style="background:#f3f5f7"><span><span lang="EN" style="font-size:11.0pt;font-family:Courier"> </span></span><span><span lang="EN" style="font-size:11.0pt;font-family:Courier;color:#004080">"f3eeab00-8367-4524-b662-55e64d4cacb5"</span></span><span lang="EN" style="font-size:11.0pt;font-family:Courier"><u></u><u></u></span></pre>
<pre style="background:#f3f5f7"><span><span lang="EN" style="font-size:11.0pt;font-family:Courier"> ]</span></span><span lang="EN" style="font-size:11.0pt;font-family:Courier"><u></u><u></u></span></pre>
<pre style="background:#f3f5f7"><span><span lang="EN" style="font-size:11.0pt;font-family:Courier">}</span></span><span lang="EN" style="font-size:11.0pt;font-family:Courier"><u></u><u></u></span></pre><p class="MsoNormal">
<span lang="EN" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Please share your thoughts.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Oleg<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Sasha Ratkovic [<a href="mailto:sasharatkovic@juniper.net" target="_blank">mailto:sasharatkovic@juniper.net</a>] <br>
<b>Sent:</b> Friday, November 16, 2012 3:38 AM<br><b>To:</b> OpenStack Development Mailing List<br><b>Subject:</b> Re: [openstack-dev] [quantum] Quantum extension framework issue<u></u><u></u></span></p></div></div><p class="MsoNormal">
<u></u> <u></u></p><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">One comment: even though health_monitor is introduced as part of LB effort, it has more general applicability. So having it under LB specific resource may pose usability problems down the road when new services are introduced, if health monitor is to be re-used for that purpose. One solution is to make it "first class" citizen with relationship to "pool" and/or make "pool" assume more abstract pooling semantics, reusable as well across multiple services in the future. (yes, I am talking about "groups" here :) ).<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p></div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From: </span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Salvatore Orlando <<a href="mailto:sorlando@nicira.com" target="_blank">sorlando@nicira.com</a>><br>
<b>Reply-To: </b>OpenStack Development Mailing List <<a href="mailto:openstack-dev@lists.openstack.org" target="_blank">openstack-dev@lists.openstack.org</a>><br><b>Date: </b>Thursday, November 15, 2012 7:40 AM<br><b>To: </b>OpenStack Development Mailing List <<a href="mailto:openstack-dev@lists.openstack.org" target="_blank">openstack-dev@lists.openstack.org</a>><br>
<b>Subject: </b>Re: [openstack-dev] [quantum] Quantum extension framework issue<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
</div><blockquote style="border:none;border-left:solid #b5c4df 4.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt"><div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">Hi Oleg, <u></u><u></u></span></p>
<div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">This is exactly what I was talking about.<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">One thing you might want to consider before choosing for one direction or the other is that at the moment Quantum API does not use sub resources at all.<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">There was a long discussion on this regard while designing the v2 API. The gist of the discussion was that if a resource needed sub-resources then there was a case for a sub-resource to become a 'first citizen' in the API. I am pretty sure you already have mulled over whether health_monitors should be a resource of their own, a sub resource of the pool, or a multi-valued attribute of the pool, but I wanted to give you a heads-up anyway.<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">On your technical questions I have some answers inline.<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">Salvatore<u></u><u></u></span></p>
<div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">On 15 November 2012 15:40, Oleg Bondarev <<a href="mailto:obondarev@mirantis.com" target="_blank">obondarev@mirantis.com</a>> wrote:<u></u><u></u></span></p>
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi folks,</span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">As Salvatore said there is a way to specify parent for a resource (see quantum.extensions.extensions.ResourceExtension) which allows route mapping for rest calls like:</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">POST /v1.0/pools/{pool_id}/health_monitors</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">DELETE /v1.0/pools/{pool_id}/health_monitors/{id}</span><span style><u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">…</span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">In this case corresponding resource controller should be aware of resource parent and be able to handle CRUD operations with an additional parent_id parameter. Currently it doesn’t. Actually I am speaking about quantum.api.v2.base.Controller – so, Salvatore, do you think it is the right place to include sub-resource/parent handling?</span><span style><u></u><u></u></span></p>
</div></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">Working on controllers in quantum.api.v2 is the best option in my opinion. <u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">This however depends on how the route mapper associates controllers with sub resources. Currently, the extension framework and the core API use two distinct code paths: the former uses quantum.extensions.extensions.ExtensionMiddleware whereas the latter uses quantum.api.v2.router.APIRouter (this is for historical reasons only; as far as I can recall, there's no technical reason for this). The Extension Middleware has a mechanism for mapping associating parent resources to a mapped resource, whereas the APIRouter does not have such mechanism.<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">As the controller does not care about how URI paths are mapped on its methods, the only thing we probably need to worry about is how to make sure that the parent resource id is passed to the controller for the sub-resource. To this aim, I would probably define a new controller which extends the base one rather than modifying quantum.api.v2.base.Controller.<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">Btw, there is of course the hackish way of skipping base.create_resource and passing to ResourceExtension an object providing implementation for the appropriate methods. I am totally sure you're aware of this option too, but I would consider it only a last resort.<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""> <u></u><u></u></span></p>
</div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt"><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">And also how do you guys think should this improvement be done as a separate patch?</span><span style><u></u><u></u></span></p>
</div></div></blockquote><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif"">Separate patches in these cases are always preferred. <u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""> <u></u><u></u></span></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Oleg</span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p>
<div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Youcef Laribi [mailto:<a href="mailto:Youcef.Laribi@eu.citrix.com" target="_blank">Youcef.Laribi@eu.citrix.com</a>] <br>
<b>Sent:</b> Wednesday, November 14, 2012 11:03 PM</span><span style><u></u><u></u></span></p><div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><br><b>To:</b> OpenStack Development Mailing List<br>
<b>Subject:</b> Re: [openstack-dev] [quantum] Quantum extension framework issue<u></u><u></u></span></p></div></div></div></div><div><div><p class="MsoNormal"><span style> <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Oleg,</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">“</span><span style="font-size:11.0pt;font-family:"Courier New"">/pools/{pool_id}/health_monitors</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">” REST resource is intended to be a collection sub-resource of the “</span><span style="font-size:11.0pt;font-family:"Courier New"">/pools/{pool_id}</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">” resource, so if the Quantum WSGI framework can be improved to support REST sub-resources that would be better and cleaner.</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Youcef</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><a name="13b0a3423f039f5f_13b04875835461eb__MailEndCompose"></a><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Salvatore Orlando <a href="mailto:[mailto:sorlando@nicira.com]" target="_blank">[mailto:sorlando@nicira.com]</a><br>
<b>Sent:</b> Wednesday, November 14, 2012 10:00 AM<br><b>To:</b> OpenStack Development Mailing List<br><b>Subject:</b> Re: [openstack-dev] [quantum] Quantum extension framework issue</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style> <u></u><u></u></span></p><div><p class="MsoNormal"><span style>Hi Oleg,<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div><p class="MsoNormal">
<span style>When I read your first email, I had the same impression as Dan.<u></u><u></u></span></p><div><p class="MsoNormal"><span style>health_monitors look more like a subresource than an action. <u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div><div><p class="MsoNormal"><span style>The WSGI framework at the moment is not able to manage subresources; this does not mean we cannot improve it though. Nevertheless, in this case the route mapping is not performed by the API classes in quantum/api, but by the extension manager. I think there should already be a way for specifying parent resources with extensions, but that needs to be explored.<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div><div><p class="MsoNormal"><span style>It seems however that you are now trying to map operations on health monitors using distinct member actions (add_health_monitor, get_health_monitors). This is similar to what happens with the L3 API for router interfaces.<u></u><u></u></span></p>
</div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><span style>However, it seems the original idea behind the API design was to treat health_monitors as an explicit collection, which would also be probably a more 'restful' way of doing it. I think ultimately the question should be directed to Youcef and the team which contributed to the design of the LBaaS API.<u></u><u></u></span></p>
<div><p class="MsoNormal"><span style>On 14 November 2012 17:18, Oleg Bondarev <<a href="mailto:obondarev@mirantis.com" target="_blank">obondarev@mirantis.com</a>> wrote:<u></u><u></u></span></p><div><div><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Dan,</span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks for your comment here. </span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Just wanted to correct a mistake in my first email: of course there can’t be a dict with duplicate keys. The idea was to use list of pairs, like:</span><span style><u></u><u></u></span></p>
<div><p class="MsoNormal" style="text-indent:.5in"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">member_actions = [{“health_monitors”: “GET”}, </span><span style><u></u><u></u></span></p>
</div><p class="MsoNormal" style="text-indent:.5in"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> {“health_monitors”: “POST”}]</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">to have an ability of using same function name with different request actions. Initially I thought that the framework provides such ability but does not dispatch requests correctly. I was wrong.</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Actually there is no issue with the framework as it assumes using unique action names for different request methods. </span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I believe we should update LBaaS REST API doc and use “get_health_monitors”, “add_health_monitors”, etc. to fit in the framework.</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Oleg</span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Dan Wendlandt [mailto:<a href="mailto:dan@nicira.com" target="_blank">dan@nicira.com</a>] <br>
<b>Sent:</b> Wednesday, November 14, 2012 7:27 PM<br><b>To:</b> OpenStack Development Mailing List<br><b>Subject:</b> Re: [openstack-dev] [quantum] Quantum extension framework issue</span><span style><u></u><u></u></span></p>
<div><div><p class="MsoNormal"><span style> <u></u><u></u></span></p><p class="MsoNormal"><span style>Hi Oleg,<u></u><u></u></span></p><div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div><div><p class="MsoNormal">
<span style>Folks from the API-subteam can correct me, but I believe this use model is outside of what the API framework was trying to enable with "actions". The idea is that you use POST/DELETE to create an delete API "resources" (which actually have UUIDs, for example, the "pool" in your example below) and then do a PUT to an "action" to cause some kind of change that you can affect on a resource (e.g., "add_health_monitor" or "remove_health_monitor"). It sounds like what you are proposing is more treating "health_monitors" almost as a "sub-resource", which is not really what the "actions" stuff was designed for. <u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div><div><p class="MsoNormal"><span style>I haven't been deeply involved in the LBaaS api design discussion though, so I'd also like to hear from Salvatore, et al. on the API sub-team.<u></u><u></u></span></p>
</div><div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div><div><p class="MsoNormal"><span style>Dan<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div><div>
<p class="MsoNormal"><span style> <u></u><u></u></span></p></div><div><div><p class="MsoNormal"><span style>On Wed, Nov 14, 2012 at 6:05 AM, Oleg Bondarev <<a href="mailto:obondarev@mirantis.com" target="_blank">obondarev@mirantis.com</a>> wrote:<u></u><u></u></span></p>
<div><div><p class="MsoNormal"><span style="color:#1f497d">Hi guys,</span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal">
<span style="color:#1f497d">While working on the API extension for LBaaS I didn’t find a way to use custom member actions if they have the same name and differ only by request method, for example</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style> <u></u><u></u></span></p><p class="MsoNormal" style="background:#f3f5f7"><span lang="EN" style="font-family:Courier">List all health monitors of a specific pool: GET /pool/pool_id/health_monitors</span><span style><u></u><u></u></span></p>
<p class="MsoNormal" style="background:#f3f5f7"><span lang="EN" style="font-family:Courier">Associate health monitors with a pool: POST /pool/pool_id/health_monitors</span><span style><u></u><u></u></span></p><p class="MsoNormal" style="background:#f3f5f7">
<span lang="EN" style> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">In quantum extension framework we pass </span><span lang="EN" style="color:#1f497d">“health_monitors” as member actions for a controller (quantum.api.v2.base.create_resource())</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN" style> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style>member_actions = {'</span><span lang="EN" style>health_monitors</span><span style>': 'GET',<u></u><u></u></span></p>
<p class="MsoNormal"><span style> '</span><span lang="EN" style>health_monitors</span><span style>': 'POST'}<u></u><u></u></span></p><p class="MsoNormal"><span style> <u></u><u></u></span></p>
<p class="MsoNormal"><span style>controller = base.create_resource(collection_name,<u></u><u></u></span></p><p class="MsoNormal"><span style> resource_name,<u></u><u></u></span></p><p class="MsoNormal">
<span style> plugin, params,<u></u><u></u></span></p><p class="MsoNormal"><span style> member_actions=member_actions)<u></u><u></u></span></p><p class="MsoNormal">
<span style> <u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">According to the Controller implementation it dispatches all custom member actions to its plugin attr:</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style> <u></u><u></u></span></p><p class="MsoNormal"><span style>def __getattr__(self, name):<u></u><u></u></span></p><p class="MsoNormal"><span style> if name in self._member_actions:<u></u><u></u></span></p>
<p class="MsoNormal"><span style> def _handle_action(request, id, body=None):<u></u><u></u></span></p><p class="MsoNormal"><span style> return getattr(self._plugin, name)(request.context, id, body)<u></u><u></u></span></p>
<p class="MsoNormal"><span style> return _handle_action<u></u><u></u></span></p><p class="MsoNormal"><span style> else:<u></u><u></u></span></p><p class="MsoNormal"><span style> raise AttributeError<u></u><u></u></span></p>
<p class="MsoNormal"><span style> <u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">Where request.context is of type quantum.context.Context and does not contain info about request method.</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d">As a result there is no way to distinguish two custom actions in the plugin. </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">Is it an issue in the framework?</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">Possible solution may be in concatenation of request method and action name (“get_health_monitors”, “post_health_monitors”) in a controller before dispatching them to a plugin.</span><span style><u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d">What do you think? </span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d"> </span><span style><u></u><u></u></span></p><p class="MsoNormal">
<span style="color:#1f497d">Thanks,</span><span style><u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">Oleg</span><span style><u></u><u></u></span></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt">
<span style><br>_______________________________________________<br>OpenStack-dev mailing list<br><a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br><a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><u></u><u></u></span></p>
</div><p class="MsoNormal"><span style><br><br clear="all"><u></u><u></u></span></p><div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div><p class="MsoNormal"><span style>-- <br>~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
Dan Wendlandt <u></u><u></u></span></p><div><p class="MsoNormal"><span style>Nicira, Inc: <a href="http://www.nicira.com" target="_blank">www.nicira.com</a><u></u><u></u></span></p><div><p class="MsoNormal"><span style>twitter: danwendlandt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></span></p></div></div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div></div></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><span style><br>_______________________________________________<br>
OpenStack-dev mailing list<br><a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br><a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><u></u><u></u></span></p>
</div><p class="MsoNormal"><span style> <u></u><u></u></span></p></div></div></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><br>
_______________________________________________<br>OpenStack-dev mailing list<br><a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br><a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><u></u><u></u></span></p>
</blockquote></div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></p></div></div></div></blockquote></div></div><br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div>