[openstack-dev] [quantum] Quantum extension framework issue

Oleg Bondarev obondarev at mirantis.com
Wed Nov 14 14:05:59 UTC 2012


Hi guys,

 

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

 

List all health monitors of a specific pool: GET
/pool/pool_id/health_monitors

Associate health monitors with a pool: POST /pool/pool_id/health_monitors

 

In quantum extension framework we pass "health_monitors" as member actions
for a controller (quantum.api.v2.base.create_resource())

 

member_actions = {'health_monitors': 'GET',

                                        'health_monitors': 'POST'}

 

controller = base.create_resource(collection_name,

                                    resource_name,

                                    plugin, params,

                                    member_actions=member_actions)

 

According to the Controller implementation it dispatches all custom member
actions to its plugin attr:

 

def __getattr__(self, name):

        if name in self._member_actions:

            def _handle_action(request, id, body=None):

                return getattr(self._plugin, name)(request.context, id,
body)

            return _handle_action

        else:

            raise AttributeError

 

Where request.context is of type quantum.context.Context and does not
contain info about request method.

As a result there is no way to distinguish two custom actions in the plugin.


Is it an issue in the framework?

 

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.

What do you think? 

 

Thanks,

Oleg

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20121114/0917fe55/attachment.html>


More information about the OpenStack-dev mailing list