diff options
| author | Rick Harris <rconradharris@gmail.com> | 2012-01-27 05:16:47 +0000 |
|---|---|---|
| committer | Rick Harris <rconradharris@gmail.com> | 2012-02-01 20:49:08 +0000 |
| commit | f79713d208a0a474581363b90ef2b87ff72ff80f (patch) | |
| tree | 87e8c420e2d5176b698963d13bd59db872223bff /nova/api | |
| parent | cbe943c349187477de1ec5a213f4f05c6825d319 (diff) | |
| download | nova-f79713d208a0a474581363b90ef2b87ff72ff80f.tar.gz nova-f79713d208a0a474581363b90ef2b87ff72ff80f.tar.xz nova-f79713d208a0a474581363b90ef2b87ff72ff80f.zip | |
Support custom routes for extensions.
Fixes bug 923983
Change-Id: Id4673a2ff58d2d94627e5878fed68bcecd9be7a4
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/__init__.py | 3 | ||||
| -rw-r--r-- | nova/api/openstack/extensions.py | 4 | ||||
| -rw-r--r-- | nova/api/openstack/volume/__init__.py | 3 |
3 files changed, 9 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/__init__.py b/nova/api/openstack/compute/__init__.py index 514b3b319..0dd3484c2 100644 --- a/nova/api/openstack/compute/__init__.py +++ b/nova/api/openstack/compute/__init__.py @@ -91,6 +91,9 @@ class APIRouter(base_wsgi.Router): mapper.resource(resource.collection, resource.collection, **kargs) + if resource.custom_routes_fn: + resource.custom_routes_fn(mapper, wsgi_resource) + def _setup_extensions(self, ext_mgr): for extension in ext_mgr.get_controller_extensions(): ext_name = extension.extension.name diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py index 417979f90..b55c05d7c 100644 --- a/nova/api/openstack/extensions.py +++ b/nova/api/openstack/extensions.py @@ -285,7 +285,8 @@ class ResourceExtension(object): """Add top level resources to the OpenStack API in nova.""" def __init__(self, collection, controller, parent=None, - collection_actions=None, member_actions=None): + collection_actions=None, member_actions=None, + custom_routes_fn=None): if not collection_actions: collection_actions = {} if not member_actions: @@ -295,6 +296,7 @@ class ResourceExtension(object): self.parent = parent self.collection_actions = collection_actions self.member_actions = member_actions + self.custom_routes_fn = custom_routes_fn def wrap_errors(fn): diff --git a/nova/api/openstack/volume/__init__.py b/nova/api/openstack/volume/__init__.py index efc2111ab..fb1a97f73 100644 --- a/nova/api/openstack/volume/__init__.py +++ b/nova/api/openstack/volume/__init__.py @@ -78,6 +78,9 @@ class APIRouter(base_wsgi.Router): mapper.resource(resource.collection, resource.collection, **kargs) + if resource.custom_routes_fn: + resource.custom_routes_fn(mapper, wsgi_resource) + def _setup_extensions(self, ext_mgr): for extension in ext_mgr.get_controller_extensions(): ext_name = extension.extension.name |
