Ask Your Question
0

Please explain what request, action and resource extension all are?

asked 2012-04-13 21:08:56 -0500

olshef gravatar image

Hi,

Trying to get a quantum extension working. Can someone explain what an action, resource, and request extension are? And how they relate to the URI and/or json body? How does each fit into the processing flow for a HTTP request?

I see 'No route' errors...my guess is that when the request comes in, it gets routed to the proper extension...so either my get_actions() and get_resources() is wrong or the URI is wrong.

I see my request extension is called with the request and a response that says 'Page not found'.

FoxinSocks hasn't helped...

Thanks, Dave

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2012-04-24 16:36:52 -0500

danwent gravatar image

Hi David,

Sorry, got behind on Quantum questions during the summit.

Resources introduce a new "entity" to the API. In Quantum, current entities are are "networks" and "ports".

Action extensions tend to be "verbs" that act on a resource. For example, in Nova, there is a "server" resources, and a "rebuild" action on that server resource: http://docs.openstack.org/cactus/openstack-compute/developer/openstack-compute-api-1.1/content/Rebuild_Server-d1e3538.html#d2278e1430 (http://docs.openstack.org/cactus/open...) . Core Quantum API doesn't really use "actions" as part of the core API, but extensions certainly could.

Request extensions allow one to add new values to existing requests objects. For example, if you were doing a POST to create a server, but wanted to add a new 'widgetType' attribute for the server object.

Looking at Foxinsox, along with the tests that use it can be helpful here: - quantum/tests/unit/extensions/foxinsocks.py - quantum/tests/unit/test_extensions.py

You can also look at other extensions in quantum/extensions, or even nova extensions in nova/api/openstack/compute/contrib/ (these are documented here: http://nova.openstack.org/api_ext/index.html (http://nova.openstack.org/api_ext/ind...) )

Usually the best thing to do is find another extension that does something similar to what you are doing, then use it as a template.

edit flag offensive delete link more
0

answered 2012-04-27 16:22:39 -0500

olshef gravatar image

Thanks, yeah, I have been using other extensions as templates....I don't understand how URI's map to resource and action extensions - how/when/where the resource & action code is executed?

For example, what is the URI and/or json that will cause the resource & action extension to be executed?

edit flag offensive delete link more
0

answered 2012-04-30 19:11:27 -0500

danwent gravatar image

the best suggestion I can give you is to look at the examples I mentioned above.

Look at quantum/tests/unit/test_extensions.py, which defines and then calls fake extensions.

If you look at the nova extensions mentioned above, then look at the client code here in https://github.com/openstack/python-novaclient/tree/master/novaclient/v1_1 (https://github.com/openstack/python-n...) to see how the client calls match up.

If you're looking to hack on openstack, in its current state reading the existing python code is often the only way to learn how to make your own changes.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2012-04-13 21:08:56 -0500

Seen: 19 times

Last updated: Apr 30 '12