summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorDan Prince <dan.prince@rackspace.com>2011-03-10 15:05:04 -0500
committerDan Prince <dan.prince@rackspace.com>2011-03-10 15:05:04 -0500
commit6b95c5133452ae26da2cb7f08267aa4cb056e7af (patch)
tree1e69a7b663351b3c1dfa5ed2776f023d2b807a1c /nova/api
parentacbc0f597f6183fc856f82b07392ddd4a61393f7 (diff)
Initial support fo extension resources. Tests.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/__init__.py8
-rw-r--r--nova/api/openstack/extensions.py29
2 files changed, 36 insertions, 1 deletions
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py
index ab9dbb780..28e2a1691 100644
--- a/nova/api/openstack/__init__.py
+++ b/nova/api/openstack/__init__.py
@@ -30,6 +30,7 @@ from nova import wsgi
from nova.api.openstack import faults
from nova.api.openstack import backup_schedules
from nova.api.openstack import consoles
+from nova.api.openstack import extensions
from nova.api.openstack import flavors
from nova.api.openstack import images
from nova.api.openstack import servers
@@ -68,7 +69,7 @@ class APIRouter(wsgi.Router):
"""Simple paste factory, :class:`nova.wsgi.Router` doesn't have one"""
return cls()
- def __init__(self):
+ def __init__(self, ext_manager=None):
mapper = routes.Mapper()
server_members = {'action': 'POST'}
@@ -111,6 +112,11 @@ class APIRouter(wsgi.Router):
collection={'detail': 'GET'},
controller=shared_ip_groups.Controller())
+ if ext_manager is None:
+ ext_manager = extensions.ExtensionManager()
+ for resource in ext_manager.get_resources():
+ resource.add_routes(mapper)
+
super(APIRouter, self).__init__(mapper)
diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py
new file mode 100644
index 000000000..1c539c500
--- /dev/null
+++ b/nova/api/openstack/extensions.py
@@ -0,0 +1,29 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 OpenStack LLC.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+class ExtensionManager(object):
+
+ def get_resources(self):
+ """
+ returns a list of ExtensionResource objects
+ """
+ return []
+
+class ExtensionResource(object):
+
+ def add_routes(self, mapper):
+ pass