diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-06-01 02:28:01 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-06-01 02:28:01 +0000 |
| commit | 5ec5dbbf3034c7e092f7513272ed7faf835de550 (patch) | |
| tree | 76e23acc8725267cbe291e239e64065329a94542 /nova/api | |
| parent | 8390ecb35e8771862b78146e5ec5ad700f9c22df (diff) | |
| parent | a25c256ef5b57b13126a1264843aa954c3ccefff (diff) | |
Merge "Adds v3 API disable config option"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/__init__.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py index 51a8785e2..c5181dd0b 100644 --- a/nova/api/openstack/__init__.py +++ b/nova/api/openstack/__init__.py @@ -20,6 +20,7 @@ WSGI middleware for OpenStack API controllers. """ +from oslo.config import cfg import routes import stevedore import webob.dec @@ -33,7 +34,15 @@ from nova import utils from nova import wsgi as base_wsgi +api_opts = [ + cfg.BoolOpt('osapi_v3_enabled', + default=False, + help='Whether the V3 API is enabled or not') +] + LOG = logging.getLogger(__name__) +CONF = cfg.CONF +CONF.register_opts(api_opts) class FaultWrapper(base_wsgi.Middleware): @@ -234,6 +243,10 @@ class APIRouterV3(base_wsgi.Router): else: return False + if not CONF.osapi_v3_enabled: + LOG.warning("V3 API has been disabled by configuration") + return + self.init_only = init_only self.api_extension_manager = stevedore.enabled.EnabledExtensionManager( namespace=self.API_EXTENSION_NAMESPACE, |
