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 | |
| parent | 8390ecb35e8771862b78146e5ec5ad700f9c22df (diff) | |
| parent | a25c256ef5b57b13126a1264843aa954c3ccefff (diff) | |
Merge "Adds v3 API disable config option"
| -rw-r--r-- | etc/nova/nova.conf.sample | 8 | ||||
| -rw-r--r-- | nova/api/openstack/__init__.py | 13 | ||||
| -rw-r--r-- | nova/test.py | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/etc/nova/nova.conf.sample b/etc/nova/nova.conf.sample index 2ba888a86..569c2d391 100644 --- a/etc/nova/nova.conf.sample +++ b/etc/nova/nova.conf.sample @@ -413,6 +413,14 @@ # +# Options defined in nova.api.openstack +# + +# Whether the V3 API is enabled or not +#osapi_v3_enabled=False + + +# # Options defined in nova.api.openstack.common # 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, diff --git a/nova/test.py b/nova/test.py index 6dad0784a..ac056ad1c 100644 --- a/nova/test.py +++ b/nova/test.py @@ -227,6 +227,7 @@ class TestCase(testtools.TestCase): self.useFixture(fixtures.EnvironmentVariable('http_proxy')) self.policy = self.useFixture(policy_fixture.PolicyFixture()) CONF.set_override('fatal_exception_format_errors', True) + CONF.set_override('osapi_v3_enabled', True) def _clear_attrs(self): # Delete attributes that don't start with _ so they don't pin |
