glance-api raises 500 error for invalid scheme while creating image

Bug #1373454 reported by Abhishek Kekane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Rajesh Tailor

Bug Description

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.

Tags: ntt
description: updated
Changed in glance:
assignee: nobody → Rajesh Tailor (rajesh-tailor)
description: updated
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/124967

Changed in glance:
status: New → In Progress
Dolph Mathews (dolph)
Changed in glance:
importance: Undecided → Low
Zhi Yan Liu (lzy-dev)
tags: added: juno-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

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

commit c38b50ed1c327ff565c5c89fc06939555ea7949b
Author: Rajesh Tailor <email address hidden>
Date: Fri Sep 26 07:59:40 2014 -0700

    Fix for Adopt glance.store library in Glance

    The store module is removed from glance project and new glance_store
    module is created, but the glance project code was not updated
    properly for the required changes.

    The exception (UnknownScheme) was moved to glance_store, but in
    glance image-create api (v1), it still refers to
    exception.UnknownScheme in get_store_or_400 method.

    Change-Id: I09e78b92d2d44a659412361b4f03b4a988714bf5
    Closes-Bug: 1373454

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → juno-rc2
tags: removed: juno-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (proposed/juno)

Fix proposed to branch: proposed/juno
Review: https://review.openstack.org/127244

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (proposed/juno)

Reviewed: https://review.openstack.org/127244
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=ad34b836fb6d8e2ba067e8c14512abc4ec0b4969
Submitter: Jenkins
Branch: proposed/juno

commit ad34b836fb6d8e2ba067e8c14512abc4ec0b4969
Author: Rajesh Tailor <email address hidden>
Date: Fri Sep 26 07:59:40 2014 -0700

    Fix for Adopt glance.store library in Glance

    The store module is removed from glance project and new glance_store
    module is created, but the glance project code was not updated
    properly for the required changes.

    The exception (UnknownScheme) was moved to glance_store, but in
    glance image-create api (v1), it still refers to
    exception.UnknownScheme in get_store_or_400 method.

    Change-Id: I09e78b92d2d44a659412361b4f03b4a988714bf5
    Closes-Bug: 1373454

Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: juno-rc2 → 2014.2
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/128928

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)
Download full text (14.4 KiB)

Reviewed: https://review.openstack.org/128928
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=858cd9d4fdf32b4cc52e02ec771d01bfb463aa77
Submitter: Jenkins
Branch: master

commit 96e28428655aa7122ed74b045ff1bda1984255b1
Author: Nikhil Komawar <email address hidden>
Date: Tue Oct 14 13:09:48 2014 -0400

    Fix options and their groups - etc/glance-api.conf

    As per the docs at [0] , some of the options should have been moved
    around in the etc/glance-api.conf. This patch changes the conf file to:

        1. indicate new default values
        2. change the group of some of the configs in order to adhere to
           new groups as expected by the deployer.
        3. deprecated configs have been removed or replaced with new ones.

    [0] http://docs.openstack.org/trunk/config-reference/content/glance-conf-changes-master.html

    Fixes bug: 1380689

    Change-Id: I5b5ab96b050b502007e6660a7a613e252404d4e8

commit 9b176a278116849c8f7b7f4d9a987f37ec52779c
Author: Andy McCrae <email address hidden>
Date: Sat Oct 11 20:56:36 2014 +0100

    Adjust authentication.rst doc to reference "identity_uri"

    The "auth_port", "auth_host", and "auth_protocol" variables were
    deprecated in favour of a single "identity_uri" variable.

    * Adjust authentication.rst doc to reference "identity_uri"

    Change-Id: I48de53f21b8d767b276858ed274066015d765f0e
    Closes-Bug: #1361613

commit 08f83f543bc992ae8f2787fb405e58c33dadba73
Author: Jamie Lennox <email address hidden>
Date: Wed Aug 6 18:24:05 2014 +1000

    Use identity_uri instead of older fragments

    This has been the default option in middleware for a while now and we
    should recommend the default options.

    Change-Id: Ief347c897cf15ab4101936a56404e3a378021b15
    (cherry picked from commit e7110a9c6e0119b3d0c6f5cdb3b9675a82b76039)

commit c0d90a580f87dbbf71e3a5d5c1b5cf8d7c7245b2
Author: Stuart McLaren <email address hidden>
Date: Wed Jul 16 13:33:32 2014 +0000

    Prevent setting swift+config locations

    Forbid setting 'swift+config' locations in a similar
    manner to 'file' for security reasons; knowledge of
    the reference name should not be exploitable.

    Setting swift+config had been prevented when swift
    was the default store, this patch changes to forbid
    setting no matter which store is the default.

    As with change id I75af34145521f533dcd6f5fd7690f5a68f3b44b3
    this is v1 only for now.

    Change-Id: I62c4980bd5c2f3dd77fc40cd007bc1067eca63a4
    Closes-bug: 1334196

commit f259cac74d3e988b4012dcc2abd30091df27f5ce
Author: Wayne Okuma <email address hidden>
Date: Wed Oct 8 08:17:20 2014 -0700

    Metadef schema column name is a reserved word in MySQL

    The metadef_properties and metadef_objects tables both have
    a column named schema. Unfortunately, schema is a reserved word
    in some relational database products, including MySQL and PostgreSQL.
    The metadef_properties.schema and metadef_objects.schema
    columns should be renamed to a non reserved word.

    Conflicts:
     glance/db/sqlalchemy/metadata.py
     glance/tests/unit/test_m...

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.