diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-06-10 18:09:23 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-06-10 18:09:23 +0000 |
| commit | 08cfd77a3658380df71f6eabbfa765b5ffcae053 (patch) | |
| tree | cc9246a20d9dc23f6a1e155ca592360e72bfdaf8 /nova/api | |
| parent | a527229c88cfd40b145e4d45a05a675aa127ea1e (diff) | |
| parent | d5ae8d5667fee22ba4df4feea53224874a19d167 (diff) | |
| download | nova-08cfd77a3658380df71f6eabbfa765b5ffcae053.tar.gz nova-08cfd77a3658380df71f6eabbfa765b5ffcae053.tar.xz nova-08cfd77a3658380df71f6eabbfa765b5ffcae053.zip | |
Merge "Adds check that the core V3 API is loaded"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/__init__.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py index 3687ce111..3455b812d 100644 --- a/nova/api/openstack/__init__.py +++ b/nova/api/openstack/__init__.py @@ -28,6 +28,7 @@ import webob.exc from nova.api.openstack import extensions from nova.api.openstack import wsgi +from nova import exception from nova import notifications from nova.openstack.common import log as logging from nova import utils @@ -55,6 +56,11 @@ CONF = cfg.CONF CONF.register_group(api_opts_group) CONF.register_opts(api_opts, api_opts_group) +# List of v3 API extensions which are considered to form +# the core API and so must be present +# TODO(cyeoh): Expand this list as the core APIs are ported to V3 +API_V3_CORE_EXTENSIONS = set(['servers']) + class FaultWrapper(base_wsgi.Middleware): """Calls down the middleware stack, making exceptions into faults.""" @@ -306,8 +312,22 @@ class APIRouterV3(base_wsgi.Router): mapper=mapper) self.api_extension_manager.map(self._register_controllers) + missing_core_extensions = self.get_missing_core_extensions( + self.loaded_extension_info.get_extensions().keys()) + if missing_core_extensions: + LOG.critical(_("Missing core API extensions: %s"), + missing_core_extensions) + raise exception.CoreAPIMissing( + missing_apis=missing_core_extensions) + super(APIRouterV3, self).__init__(mapper) + @staticmethod + def get_missing_core_extensions(extensions_loaded): + extensions_loaded = set(extensions_loaded) + missing_extensions = API_V3_CORE_EXTENSIONS - extensions_loaded + return missing_extensions + @property def loaded_extension_info(self): raise NotImplementedError() |
