diff options
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() |
