Extension definition of resource doesn't take uri prefix into account

Bug #1344642 reported by Brandon Logan
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Expired
Medium
Unassigned

Bug Description

When an extension is defined, it usually defines a dictionary that describes the new resources and the attributes of the body of the request. A prefix is also defined as a resource to prepend all resources in the extension. If two extensions define the same resource, but define different attributes of that resource then when a request is made to both resources, the expected attributes will be the union of both resources'.

For example:

ExtensionA defines its resources with this dictionary:

{"pools": {"id": {...}, "lb_method": {...}}

It has prefix of /lb

ExtensionB defines its resources with this dictionary:

{"pools": {"id": {...}, "lb_algorithm": {...}}

it has a prefix of /lbaas

When a POST request is made to /lb/pools and /lbaas/pools then the request MUST contain:

{"pool": {"lb_method": "SOME_METHOD", "lb_algorithm": "SOME_ALGORITHM"}}

The reason is because the extension loader does not take into account the prefix when it comes to loading the resources. The resources are loaded into a dictionary called attr_map and if attr_map already has a resource in it, it just calls an update on the dictionary, which is why both attributes end up being expected.

https://github.com/openstack/neutron/blob/master/neutron/api/extensions.py in extend_resources method.

Tags: api
ugvddm (271025598-9)
Changed in neutron:
assignee: nobody → ugvddm (271025598-9)
tags: added: api
Changed in neutron:
importance: Undecided → Medium
status: New → Confirmed
summary: - Extension definition of resource attributes incorrectly loads resources
+ Extension definition of resource doesn't take uri prefix into account
Revision history for this message
ugvddm (271025598-9) wrote :

I can't find a good solution to solve this issue, maybe someone will, so I reopen it.

Changed in neutron:
assignee: ugvddm (271025598-9) → nobody
Changed in neutron:
assignee: nobody → Jacek Świderski (jacek-swiderski)
Changed in neutron:
assignee: Jacek Świderski (jacek-swiderski) → nobody
Maruti Kamat (marutik)
Changed in neutron:
assignee: nobody → Maruti Kamat (marutik)
Revision history for this message
Eugene Nikanorov (enikanorov) wrote :

I think this can be closed as Invalid especially in the prospect of API layer refactoring planned for Kilo

Changed in neutron:
assignee: Maruti Kamat (marutik) → nobody
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for neutron because there has been no activity for 60 days.]

Changed in neutron:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.