Registry 500 error when listing images whose names are null

Bug #1183860 reported by Stuart McLaren
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Stuart McLaren

Bug Description

create some images with nothing in the name field:

 $ glance --os-password XXX --os-username glance --os-tenant-name service --os-auth-url http://localhost:5000/v2.0 index
ID Name Disk Format Container Format Size
------------------------------------ ------------------------------ -------------------- -------------------- --------------
3b3d1744-a378-4e46-a766-23b8e90f3270 None raw bare 754
6588874b-d96d-440b-a419-e155d5dd21f9 None raw bare 754
7d12f2ba-a1f5-4dc7-852a-2b5006eac7fb None raw bare 754
ea893248-87d7-49d8-ab5f-8c46077377cc None raw bare 754
3ee241b5-4f85-4bb0-9349-efd4af310dbb x2 raw bare 754
c7863541-a755-4063-a982-bc8a73dfed43 x2 raw bare 754
2a62cba7-5a70-4727-95d2-c0f89bd025ef x2 raw bare 754
3a71302d-0870-4154-80d4-703e940922b4 x1 raw bare 754
e921ee68-31a8-41b8-9232-733d22c7e113 cirros-0.3.1-x86_64-uec ami ami 25165824
a2558cbc-f8ba-45e0-be79-747f04cbd0ed cirros-0.3.1-x86_64-uec-kernel aki aki 4955792
5e2e2e49-fe1d-4568-9996-5d86e5322845 cirros-0.3.1-x86_64-uec-ramdis ari ari 3714968

Now, using a small page size, perform an image list:

$ glance --os-password hpinvent --os-username glance --os-tenant-name service --os-auth-url http://localhost:5000/v2.0 image-list --page-size 3
Request returned failure status.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 383, 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 456, 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 591, in __call__
    request, **action_args)
  File "/opt/stack/glance/glance/common/wsgi.py", line 608, in dispatch
    return method(*args, **kwargs)
  File "/opt/stack/glance/glance/api/v1/images.py", line 204, in detail
    images = registry.get_images_detail(req.context, **params)
  File "/opt/stack/glance/glance/registry/client/v1/api.py", line 148, in get_images_detail
    return c.get_images_detailed(**kwargs)
  File "/opt/stack/glance/glance/registry/client/v1/client.py", line 115, in get_images_detailed
    res = self.do_request("GET", "/images/detail", params=params)
  File "/opt/stack/glance/glance/registry/client/v1/client.py", line 90, in do_request
    **kwargs)
  File "/opt/stack/glance/glance/common/client.py", line 62, in wrapped
    return func(self, *args, **kwargs)
  File "/opt/stack/glance/glance/common/client.py", line 376, in do_request
    headers=headers)
  File "/opt/stack/glance/glance/common/client.py", line 79, in wrapped
    return func(self, method, url, body, headers)
  File "/opt/stack/glance/glance/common/client.py", line 514, in _do_request
    raise exception.ServerError()

The registry stack trace ends with:

 exc.ArgumentError("Only '='/'Unable to render embedded object: File ( Only '='/') not found.=' operators can be used with NULL

Changed in glance:
assignee: nobody → Stuart McLaren (stuart-mclaren)
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/30859

Changed in glance:
status: New → In Progress
Revision history for this message
John Bresnahan (jbresnah) wrote :

Should we be allowing null names at all? This client side bug assumes that we should not: https://bugs.launchpad.net/python-glanceclient/+bug/1184965

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

Reviewed: https://review.openstack.org/30859
Committed: http://github.com/openstack/glance/commit/cd7bbc30175e90661baa90fff02232013b49dd06
Submitter: Jenkins
Branch: master

commit cd7bbc30175e90661baa90fff02232013b49dd06
Author: Stuart McLaren <email address hidden>
Date: Wed May 29 10:23:57 2013 +0000

    Prevent E500 when listing with null values

    An image may have NULL values for 'name', 'disk_format' and
    'container_format'.

    Various image list operations which used a marker could return
    an E500 because:

    * sqlalchemy db: an illegal statement would be formed
    * simple db: the sort function would error when it hit a null

    To prevent this we change the behaviour so that when a NULL
    is encountered we treat it as an emptry string ('') for the
    purposes of sorting. This is consistent with the behaviour
    for listing the db contents using 'sql order by'.

    It is safe to provide the default empty string in all cases
    since only string based 'sort_key' values can be NULL in the
    database, eg 'size' (not a string) cannot be NULL.

    Fixes bug 1183860.

    Change-Id: I2187c41a3fab8b5813ba3a5e0f3249ee5dd981ed

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