Glance v1: Creating image with bad scheme in location causes 500

Bug #1257496 reported by Alex Meade
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Yanis Guenane

Bug Description

When creating an image in glance v1 and specifyig the location with a bad scheme you receive an HTTP 500. In this case 'http+swift" is a bad scheme.

glance image-create --name bad-location --disk-format=vhd --container-format=ovf --location="http+swift://bah"

Request returned failure status.
HTTPInternalServerError (HTTP 500)

2013-12-03 21:24:32.009 6312 INFO glance.wsgi.server [402e831a-935d-4e14-b4c8-64653c14263d 1c3848b015f94b70866e
a33fa52945f0 54bc4959075343ff80f460b77e783a49] Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 389, in handle_one_response
    result = self.application(self.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 "/opt/stack/glance/glance/common/wsgi.py", line 367, in __call__
    response = 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 "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 581, in __call__
    return self.app(env, 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 "/opt/stack/glance/glance/common/wsgi.py", line 367, in __call__
    response = 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 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 "/opt/stack/glance/glance/common/wsgi.py", line 367, in __call__
    response = 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 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 "/opt/stack/glance/glance/common/wsgi.py", line 367, in __call__
    response = 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/lib/python2.7/dist-packages/paste/urlmap.py", line 203, in __call__
    return 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/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 "/opt/stack/glance/glance/common/wsgi.py", line 599, in __call__
    request, **action_args)
  File "/opt/stack/glance/glance/common/wsgi.py", line 618, in dispatch
    return method(*args, **kwargs)
  File "/opt/stack/glance/glance/common/utils.py", line 422, in wrapped
    return func(self, req, *args, **kwargs)
  File "/opt/stack/glance/glance/api/v1/images.py", line 754, in create
    image_meta = self._reserve(req, image_meta)
  File "/opt/stack/glance/glance/api/v1/images.py", line 488, in _reserve
    store = get_store_from_location(location)
  File "/opt/stack/glance/glance/store/__init__.py", line 263, in get_store_from_location
    loc = location.get_location_from_uri(uri)
  File "/opt/stack/glance/glance/store/location.py", line 73, in get_location_from_uri
    raise exception.UnknownScheme(scheme=pieces.scheme)
UnknownScheme: Unknown scheme 'http+swift' found in URI

2013-12-03 21:24:32.011 6312 INFO glance.wsgi.server [402e831a-935d-4e14-b4c8-64653c14263d 1c3848b015f94b70866ea33fa52945f0 54bc4959075343ff80f460b77e783a49] localhost - - [03/Dec/2013 21:24:32] "POST /v1/images HTTP/1.1" 500 139 0.216952

Alex Meade (alex-meade)
description: updated
Changed in glance:
status: New → Confirmed
Changed in glance:
assignee: nobody → Yanis Guenane (yanis-guenane)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

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

Reviewed: https://review.openstack.org/60333
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=5ec9baa8857646e0608cd9a3135d172f3b92327c
Submitter: Jenkins
Branch: master

commit 5ec9baa8857646e0608cd9a3135d172f3b92327c
Author: Yanis Guenane <email address hidden>
Date: Thu Dec 5 19:34:52 2013 +0000

    Replace startswith by more precise store matching

    Currently a source is considered valid if it only starts with a specific set
    of word. For example swift is a valid location scheme, so is swiftpe or
    swiftopenstack with the current implementation. This commit compare the scheme
    of the location - all of it - to a given set of supported schemes

    Change-Id: Ie827c3c3f36fbf958a1270039cab28d4c5fc4fe1
    Closes-Bug: #1257496

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → icehouse-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: icehouse-2 → 2014.1
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.