~jdurgin/nova/rbd_volume

« back to all changes in this revision

Viewing changes to nova/api/openstack/__init__.py

  • Committer: Tarmac
  • Author(s): Todd Willey
  • Date: 2011-01-03 19:54:39 UTC
  • mfrom: (469.7.11 paste)
  • Revision ID: tarmac-20110103195439-ac1ohjs2jwu0z3xv
Uses paste.deploy to make application running configurable.  This includes the ability to swap out middlewares, define new endpoints, and generally move away from having code to build wsgi routers and middleware chains into a configurable, extensible method for running wsgi servers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
WSGI middleware for OpenStack API controllers.
21
21
"""
22
22
 
23
 
import json
24
23
import time
25
24
 
26
25
import logging
41
40
from nova.api.openstack import ratelimiting
42
41
from nova.api.openstack import servers
43
42
from nova.api.openstack import sharedipgroups
44
 
from nova.auth import manager
45
43
 
46
44
 
47
45
FLAGS = flags.FLAGS
115
113
                        controller=sharedipgroups.Controller())
116
114
 
117
115
        super(APIRouter, self).__init__(mapper)
 
116
 
 
117
 
 
118
class Versions(wsgi.Application):
 
119
    @webob.dec.wsgify
 
120
    def __call__(self, req):
 
121
        """Respond to a request for all OpenStack API versions."""
 
122
        response = {
 
123
                "versions": [
 
124
                    dict(status="CURRENT", id="v1.0")]}
 
125
        metadata = {
 
126
            "application/xml": {
 
127
                "attributes": dict(version=["status", "id"])}}
 
128
        return wsgi.Serializer(req.environ, metadata).to_content_type(response)
 
129
 
 
130
 
 
131
def router_factory(global_cof, **local_conf):
 
132
    return APIRouter()
 
133
 
 
134
 
 
135
def versions_factory(global_conf, **local_conf):
 
136
    return Versions()