When an invalid container format is specified in an upload-to-image command, cinder-api logs an exception because the error returned from glance is first seen by the wsgi fault wrapper.
Ideally, the exception would be caught and turned into a helpful user message that indicates what went wrong.
Command:
$ cinder upload-to-image --container-format utterly-invalid-format-name 468ee750-a154-4610-8b18-f330593033f7 from-cinder
ERROR: The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400) (Request-ID: req-f19bad2f-c39d-40a2-a3cc-6db9b9fe64cd)
Logs (cinder-api):
2014-04-16 17:52:15.520 DEBUG glanceclient.common.http [req-f19bad2f-c39d-40a2-a3cc-6db9b9fe64cd 0c584884e8994df8bdf7449442f25972 d5ab5c34a8534b26ae7b7a7882c51b01] Request returned failure status: 400 from (pid=2306) _http_request /opt/st>
2014-04-16 17:52:15.520 ERROR cinder.api.middleware.fault [req-f19bad2f-c39d-40a2-a3cc-6db9b9fe64cd 0c584884e8994df8bdf7449442f25972 d5ab5c34a8534b26ae7b7a7882c51b01] Caught error: 400 Bad Request
Invalid container format 'utterly-invalid-format-name' for image.
(HTTP 400)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault Traceback (most recent call last):
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/middleware/fault.py", line 75, in __call__
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return req.get_response(self.application)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/webob/request.py", line 1296, in send
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault application, catch_exc_info=False)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/webob/request.py", line 1260, in call_application
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault app_iter = application(self.environ, start_response)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return resp(environ, start_response)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 615, in __call__
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return self.app(env, start_response)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return resp(environ, start_response)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return resp(environ, start_response)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/routes/middleware.py", line 131, in __call__
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault response = self.app(environ, start_response)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return resp(environ, start_response)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault resp = self.call_func(req, *args, **self.kwargs)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return self.func(req, *args, **kwargs)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 895, in __call__
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault content_type, body, accept)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 943, in _process_stack
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault action_result = self.dispatch(meth, request, action_args)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 1019, in dispatch
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return method(req=request, **action_args)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/contrib/volume_actions.py", line 258, in _volume_upload_image
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault force)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/volume/api.py", line 75, in wrapped
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return func(self, context, target_obj, *args, **kwargs)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/volume/api.py", line 714, in copy_volume_to_image
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault recv_metadata = self.image_service.create(context, metadata)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/image/glance.py", line 286, in create
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault **sent_service_image_meta)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/image/glance.py", line 158, in call
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return getattr(client.images, method)(*args, **kwargs)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/python-glanceclient/glanceclient/v1/images.py", line 255, in create
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault 'POST', '/v1/images', headers=hdrs, body=image_data)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/python-glanceclient/glanceclient/common/http.py", line 313, in raw_request
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault return self._http_request(url, method, **kwargs)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault File "/opt/stack/python-glanceclient/glanceclient/common/http.py", line 249, in _http_request
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault raise exc.from_response(resp, body_str)
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault HTTPBadRequest: 400 Bad Request
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault Invalid container format 'utterly-invalid-fomat-name' for image.
2014-04-16 17:52:15.520 TRACE cinder.api.middleware.fault (HTTP 400)
Fix proposed to branch: master /review. openstack. org/88063
Review: https:/