extension framework should support extended attributes on core resources

Bug #1023111 reported by Robert Kukura
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Robert Kukura

Bug Description

Quantum API extensions such as https://blueprints.launchpad.net/quantum/+spec/provider-networks add extended attributes to the request and response messages of existing core resource actions (create, get, get collection, update, delete). This category of extension is implemented within a plugin, typically exposing details of how the plugin maps core API virtual resources to physical networking mechanisms.

The existing quantum.extensions.extensions.RequestExtension mechanism is not satisfactory for this category of API extension for several reasons. First, its handler function is executed completely outside the context of the core API and the plugin's methods that implements the operations on the core resource. This handler function therefore needs to make separate calls into the plugin to get data to be returned in the response, resulting in extra DB queries, etc. Also, details from the request such as context, output field selections, and filter expressions are not readily available to the handler function. Finally, the handler function must de-serialize the core response message, add its extended attributes, and then re-serialize the message, which is inefficient and only works for JSON.

Instead, the core V2 API mechanism needs to know about the extended attributes so that they are handled similarly to the attributes defined in the core API (but scoped in the extension's namespace). This can currently be achieved by editing the quantum.api.v2.router.RESOURCE_ATTRIBUTE_MAP for request message attributes, and the keys tuples in the quantum.api.v2.views.<resource> classes for response message attributes. Once this is done, the extended request attributes are available (with defaulting and allow_put/allow_post checking) to the plugin's core API method implementation (i.e. in the network dictionary parameter passed into create_network), and the extended response attributes are copied (if present) from the dictionaries returned by the plugin's core API method implementations into the response messages. Thus, from the perspective of a plugin's core API methods, the extended attributes can be handled exactly like core attributes.

But extensions should not require modification of core code. Therefore a mechanism is needed by which an extension can register the extended attributes that it defines, so the same result is achieved. This mechanism would most likely result in the extended attribute data being added to the RESOURCE_ATTRIBUTE_MAP used in processing input messages, and to the lists of keys copied from returned dictionaries to response messages.

Revision history for this message
Robert Kukura (rkukura) wrote :

It would make sense to coordinate the solution for this bug with that for https://bugs.launchpad.net/quantum/+bug/1007998 so that extended attributes are properly handled in XML (including use of the extension's XML namespace where necessary). I added a similar comment to that bug too.

dan wendlandt (danwent)
Changed in quantum:
milestone: none → folsom-3
importance: Undecided → High
status: New → Confirmed
Robert Kukura (rkukura)
Changed in quantum:
assignee: nobody → Robert Kukura (rkukura)
Revision history for this message
dan wendlandt (danwent) wrote :

Hi Bob, yesterday we were talking with Yong and he mentioned that he was interested in working improving Quantum's API extensions mechanism (at that point, this bug was unassigned). I'm guessing you'd welcome having him contribute as you also have the provider networks blueprint to worry about as well, so it would be great if you two could come up with a plan to divide and conquer.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

Fix proposed to branch: master
Review: https://review.openstack.org/9849

Changed in quantum:
status: Confirmed → In Progress
Revision history for this message
Robert Kukura (rkukura) wrote :

Please see the WIP patch referenced above for a very minimalistic approach to supporting extended attributes. I'd like to get consensus as soon as possible on whether this approach is sufficient for now, and if so, get it cleaned up, formally reviewed, and merged so that the provider-networks BP phase 1 implementation review can proceed.

But even if this approach is adopted for now, there are many shortcomings to the current extension framework that should be addressed separately. One idea is that the a data-driven approach to extended resources might be feasible, and would have many of the same benefits as the data-driven approach to extended attributes.

Also, client-side support for extended attributes and extended resources is needed.

Revision history for this message
Kyle Mestery (mestery) wrote :

I think this approach makes sense, the patch you posted looks good Bob. Like you said, the other shortcomings to the extension framework need to be handled separately.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/9849
Committed: http://github.com/openstack/quantum/commit/a01ca27a88bfc7bdc6913580700315a7789e5a70
Submitter: Jenkins
Branch: master

commit a01ca27a88bfc7bdc6913580700315a7789e5a70
Author: Bob Kukura <email address hidden>
Date: Sun Jul 15 20:45:25 2012 -0400

    Implements data-driven views and extended attributes.

    The quantum/api/v2/views.py module is replaced by is_visible
    properties in the RESOURCE_ATTRIBUTE_MAP defined in
    quantum/api/v2/attributes.py. Extensions are given the ability to add
    extended attribute descriptions to this map during initialization,
    allowing extended attributes to be implemented similarly to core
    attributes in plugins.

    Resolves bug 1023111.

    Change-Id: Ic6e224d5d841b6a1d4d1c762d7306adaf91f7a2d

Changed in quantum:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in quantum:
milestone: folsom-3 → 2012.2
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.