← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1344642] [NEW] Extension definition of resource attributes incorrectly loads resources

 

Public bug reported:

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.

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1344642

Title:
  Extension definition of resource attributes incorrectly loads
  resources

Status in OpenStack Neutron (virtual network service):
  New

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1344642/+subscriptions


Follow ups

References