image creation causes stacktrace

Bug #1169560 reported by Christopher Yeoh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Christopher Yeoh
Grizzly
Fix Released
Medium
Christopher Yeoh

Bug Description

From a tempest test test_create_image_specify_name_over_256_chars when creating an image with
a name which is too long it causes a stacktrace in the logs because the exception from glance is
not caught. Though the end result is ok as the uncaught exception is still a 400 Bad Request.

x-openstack-request-id: req-b9f7a737-6692-4d02-8101-cecce2f5b341

400 Bad Request

Image name too long: 269

2013-04-16 17:10:37 ERROR [glanceclient.common.http] Request returned failure status.
2013-04-16 17:10:37 ERROR [nova.api.openstack] Caught error: 400 Bad Request
Image name too long: 269
    (HTTP 400)
Traceback (most recent call last):
  File "/srv/compile/openstack/nova/nova/api/openstack/__init__.py", line 81, in __call__
    return req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 451, in __call__
    return self.app(env, start_response)
  File "/usr/local/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/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/local/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/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/srv/compile/openstack/nova/nova/api/openstack/wsgi.py", line 899, in __call__
    content_type, body, accept)
  File "/srv/compile/openstack/nova/nova/api/openstack/wsgi.py", line 951, in _process_stack
    action_result = self.dispatch(meth, request, action_args)
  File "/srv/compile/openstack/nova/nova/api/openstack/wsgi.py", line 1030, in dispatch
    return method(req=request, **action_args)
  File "/srv/compile/openstack/nova/nova/api/openstack/common.py", line 448, in inner
    return f(*args, **kwargs)
  File "/srv/compile/openstack/nova/nova/api/openstack/compute/servers.py", line 1365, in _action_create_image
    extra_properties=props)
  File "/srv/compile/openstack/nova/nova/compute/api.py", line 167, in wrapped
    return func(self, context, target, *args, **kwargs)
  File "/srv/compile/openstack/nova/nova/compute/api.py", line 138, in inner
    return f(self, context, instance, *args, **kw)
  File "/srv/compile/openstack/nova/nova/compute/api.py", line 1505, in snapshot
    'snapshot', extra_properties=extra_properties)
  File "/srv/compile/openstack/nova/nova/compute/api.py", line 1579, in _create_image
    return self.image_service.create(context, sent_meta)
  File "/srv/compile/openstack/nova/nova/image/glance.py", line 295, in create
    context, 1, 'create', **sent_service_image_meta)
  File "/srv/compile/openstack/nova/nova/image/glance.py", line 182, in call
    return getattr(client.images, method)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/glanceclient/v1/images.py", line 250, in create
    'POST', '/v1/images', headers=hdrs, body=image_data)
  File "/usr/local/lib/python2.7/dist-packages/glanceclient/common/http.py", line 244, in raw_request
    return self._http_request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/glanceclient/common/http.py", line 205, in _http_request
    raise exc.from_response(resp, body_str)
HTTPBadRequest: 400 Bad Request
Image name too long: 269
    (HTTP 400)
2013-04-16 17:10:37 INFO [nova.api.openstack] http://192.168.1.18:8774/v2/9c238a60c19b45608c2a82f4687f266d/servers/9610fcd1-c29d-4b48-960a-062583e5e086/action returned with HTTP 400
2013-04-16 17:10:37 DEBUG [nova.api.openstack.wsgi] Returning 400 to user: The server could not comply with the request since it is either malformed or otherwise incorrect.
2013-04-16 17:10:37 INFO [nova.osapi_compute.wsgi.server] 192.168.1.18 "POST /v2/9c238a60c19b45608c2a82f4687f266d/servers/9610fcd1-c29d-4b48-960a-062583e5e086/action HTTP/1.1" status: 400 len: 338 time: 0.1240311

Changed in nova:
assignee: nobody → Christopher Yeoh (cyeoh-0)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/26999

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/26999
Committed: http://github.com/openstack/nova/commit/09c7fc3b694ab401d42c9e59b17e24bbe4383588
Submitter: Jenkins
Branch: master

commit 09c7fc3b694ab401d42c9e59b17e24bbe4383588
Author: Chris Yeoh <email address hidden>
Date: Tue Apr 16 23:01:26 2013 +0930

    Catch glance image create exceptions

    Catch exception from glance when image creation fails because the
    requested name is too long. Currently the exception is not caught
    in the api which results in an 400 Bad Request correctly being
    returned, but also leaving a traceback in the logs. Correctly catching
    the exception and explicitly raising an HTTPBadRequest removes
    the production of the traceback.

    Fixes bug #1169560

    Change-Id: I511da79cb0b1b4578bf43f0819b2ac64fb6e5fb3

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/27953

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/grizzly)

Reviewed: https://review.openstack.org/27953
Committed: http://github.com/openstack/nova/commit/a313b12aecd32c203055f59024f3df8d05116554
Submitter: Jenkins
Branch: stable/grizzly

commit a313b12aecd32c203055f59024f3df8d05116554
Author: Chris Yeoh <email address hidden>
Date: Tue Apr 16 23:01:26 2013 +0930

    Catch glance image create exceptions

    Catch exception from glance when image creation fails because the
    requested name is too long. Currently the exception is not caught
    in the api which results in an 400 Bad Request correctly being
    returned, but also leaving a traceback in the logs. Correctly catching
    the exception and explicitly raising an HTTPBadRequest removes
    the production of the traceback.

    Fixes bug #1169560

    Change-Id: I511da79cb0b1b4578bf43f0819b2ac64fb6e5fb3
    (cherry picked from commit 09c7fc3b694ab401d42c9e59b17e24bbe4383588)

tags: added: in-stable-grizzly
Changed in nova:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-1
status: Fix Committed → Fix Released
Alan Pevec (apevec)
tags: removed: in-stable-grizzly
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.