[openstack-dev] [nova] Placement API WSGI code -- let's just use flask

Sean Dague sean at dague.net
Tue Jun 21 15:42:45 UTC 2016

On 06/21/2016 10:10 AM, Clint Byrum wrote:
> Excerpts from Sean Dague's message of 2016-06-21 08:00:50 -0400:
>> On 06/21/2016 07:39 AM, Jay Pipes wrote:
>>> On 06/21/2016 05:43 AM, Sylvain Bauza wrote:
>>>> Le 21/06/2016 10:04, Chris Dent a écrit :
>>>>> On Mon, 20 Jun 2016, Jay Pipes wrote:
>>>>>> Flask seems to be the most widely used and known WSGI framework so
>>>>>> for consistency's sake, I'm recommending we just use it and not rock
>>>>>> this boat. There are more important things to get hung up on than
>>>>>> this battle right now.
>>>>> That seems perfectly reasonable. My main goal in starting the
>>>>> discussion was to ensure that we reach some kind of consensus,
>>>>> whatever it might be[1]. It won't be too much of an ordeal to
>>>>> turn the existing pure WSGI stuff into Flask stuff.
>>>>> From my standpoint doing the initial development in straight WSGI
>>>>> was a win as it allowed for a lot of clarity from the inside out.
>>>>> Now that that development has shown the shape of the API we can
>>>>> do what we need to do to make it clear from outside in.
>>>>> Next question: There's some support for not using Paste and
>>>>> paste.ini. Is anyone opposed to that?
>>>> Given Flask is not something we support yet in Nova, could we discuss on
>>>> that during either a Nova meeting, or maybe wait for the midcycle ?
>>> I really don't want to wait for the mid-cycle. Happy to discuss in the
>>> Nova meeting, but my preference is to have Chris just modify his patch
>>> series to use Flask now and review it.
>>>> To be honest, Chris and you were saying that you don't like Flask, and
>>>> I'm a bit agreeing with you. Why now it's a good possibility ?
>>> Because Doug persuaded me that the benefits of being consistent with
>>> what the community is using outweigh my (and Chris') personal misgivings
>>> about the particular framework.
>> Just to be clear....
>> http://codesearch.openstack.org/?q=Flask%3E%3D0.10&i=nope&files=&repos=
>> Flask is used by 2 (relatively new) projects in OpenStack
>> If we look at the iaas base layer:
>> Keystone - custom WSGI with Routes / Paste
>> Glance - WSME + Routes / Paste
>> Cinder - custom WSGI with Routes / Paste
>> Neutron - pecan + Routes / Paste
>> Nova - custom WSGI with Routes / Paste
> When I see "custom WSGI" I have a few thoughts:
> * custom == special snowflake. But REST API's aren't exactly novel.
> * If using a framework means not writing or cargo culting any custom
> WSGI code, that seems like a win for maintainability from the get go.
> * If using a framework means handling errors more consistently, that
> seems like a win for operators.
> * I don't have a grasp on how much custom WSGI code is actually
> involved. That would help us all evaluate the meaning of the statements
> above (both yours, and mine).

And my point is, it's not actually much. Because you still have to do
paste, and you still have to do request validation, and you still have
to actually right controllers and views. Routes has a restful resource
model -
https://routes.readthedocs.io/en/latest/restful.html#restful-services -
which is really not more complicated than the router decorators you get
with other services.

The places that we have large complicated wsgi flows is because we
supported extensions that can modify requests/responses, or the whole
XML/JSON content switching (which was a nightmare). All of these things
are being deleted.

If you actually look at the Nova patches that Chris is building, the
logic that's the wsgi "framework" is quite small and the application
logic is pretty much what it is going to be in any framework -


Sean Dague

More information about the OpenStack-dev mailing list