summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-02-02 00:30:47 +0000
committerGerrit Code Review <review@openstack.org>2012-02-02 00:30:47 +0000
commitb13c567ba74a0b7abc8b48d7e21b759c6ff43fbe (patch)
tree045103386ad961267230408ec00a9443d61bc09f /nova/api
parent11f26257407a68cd73ff4474ed10fb45b480836a (diff)
parentf79713d208a0a474581363b90ef2b87ff72ff80f (diff)
Merge "Support custom routes for extensions."
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/__init__.py3
-rw-r--r--nova/api/openstack/extensions.py4
-rw-r--r--nova/api/openstack/volume/__init__.py3
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