glance-api raises 500 error for invalid scheme while creating image using v1 api in get_store_or_400() method.
The reason, in this method exception.UnknownScheme() exception is caught and this UnknownScheme exception class is not present in glance/common/excepion.py module as it is moved under glance_store project.
Ideally it should caught UnknownScheme exception from glance_store's exception module.
Stacktrace on glance-api screen:
2014-09-24 07:06:38.868 31867 INFO glance.wsgi.server [e03c9dff-5213-4b05-9958-9b53d404c419 8264cb3f7ed04408ad6df9f6741f5be2 be4a5d48cbb748be923182b30ec
ed78c - - -] Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 434, in handle_one_response
result = self.application(self.environ, start_response)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/opt/stack/glance/glance/common/wsgi.py", line 394, in __call__
response = req.get_response(self.application)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1320, in send
application, catch_exc_info=False)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1284, in call_application
app_iter = application(self.environ, start_response)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/osprofiler/web.py", line 106, in __call__
return request.get_response(self.application)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1320, in send
application, catch_exc_info=False)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1284, in call_application
app_iter = application(self.environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token.py", line 559, in __call__
return self._app(env, start_response)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/opt/stack/glance/glance/common/wsgi.py", line 394, in __call__
response = req.get_response(self.application)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1320, in send
application, catch_exc_info=False)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1284, in call_application
app_iter = application(self.environ, start_response)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/opt/stack/glance/glance/common/wsgi.py", line 394, in __call__
response = req.get_response(self.application)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1320, in send
application, catch_exc_info=False)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1284, in call_application
app_iter = application(self.environ, start_response)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/opt/stack/glance/glance/common/wsgi.py", line 394, in __call__
response = req.get_response(self.application)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1320, in send
application, catch_exc_info=False)
File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1284, in call_application
app_iter = application(self.environ, start_response)
File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 206, in __call__
return app(environ, start_response)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
return resp(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
response = self.app(environ, start_response)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
return resp(environ, start_response)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/opt/stack/glance/glance/common/wsgi.py", line 683, in __call__
request, **action_args)
File "/opt/stack/glance/glance/common/wsgi.py", line 707, in dispatch
return method(*args, **kwargs)
File "/opt/stack/glance/glance/common/utils.py", line 449, in wrapped
return func(self, req, *args, **kwargs)
File "/opt/stack/glance/glance/api/v1/images.py", line 824, in create
image_meta = self._reserve(req, image_meta)
File "/opt/stack/glance/glance/api/v1/images.py", line 538, in _reserve
self.get_store_or_400(req, backend)
File "/opt/stack/glance/glance/api/v1/images.py", line 1100, in get_store_or_400
except exception.UnknownScheme:
AttributeError: 'module' object has no attribute 'UnknownScheme'
Note:
I have explicitly raised the store.UnknownScheme exception from the method get_store_or_400 to reproduce this error.
Fix proposed to branch: master /review. openstack. org/124967
Review: https:/