glance-cache-prefetcher explodes when no auth parameters were configured

Bug #1157765 reported by Flavio Percoco
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Flavio Percoco
Folsom
Fix Released
Medium
Flavio Percoco
Grizzly
Fix Released
Medium
Flavio Percoco

Bug Description

Description of problem:

If there're no auth parameters configured in glance-cache.conf, glance-cache-prefetcher fails and prints a traceback.

How reproducible:

very

Steps to Reproduce:
1. install glance
2. configure cachemanager
3. use keystone as auth backend
4. queue an image for cache
5. remove keystone parameters from glance-cache.conf
6. call glance-cache-prefetcher

Actual results:
[root@interceptor glance(keystone_admin)]# glance-cache-prefetcher --debug
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/eventlet/hubs/hub.py", line 336, in fire_timers
    timer()
  File "/usr/lib/python2.6/site-packages/eventlet/hubs/timer.py", line 56, in __call__
    cb(*args, **kw)
  File "/usr/lib/python2.6/site-packages/eventlet/greenthread.py", line 192, in main
    result = function(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/image_cache/prefetcher.py", line 53, in fetch_image_into_cache
    image_meta = registry.get_image_metadata(ctx, image_id)
  File "/usr/lib/python2.6/site-packages/glance/registry/__init__.py", line 133, in get_image_metadata
    return c.get_image(image_id)
  File "/usr/lib/python2.6/site-packages/glance/registry/client.py", line 121, in get_image
    res = self.do_request("GET", "/images/%s" % image_id)
  File "/usr/lib/python2.6/site-packages/glance/registry/client.py", line 89, in do_request
    action, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 63, in wrapped
    return func(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 440, in do_request
    self._authenticate()
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 418, in _authenticate
    auth_plugin.authenticate()
  File "/usr/lib/python2.6/site-packages/glance/common/auth.py", line 125, in authenticate
    self.check_auth_params()
  File "/usr/lib/python2.6/site-packages/glance/common/auth.py", line 94, in check_auth_params

    if self.creds['auth_url'].rstrip('/').endswith('v2.0'):
AttributeError: 'NoneType' object has no attribute 'rstrip'
Traceback (most recent call last):
  File "/usr/bin/glance-cache-prefetcher", line 53, in <module>
    app.run()
  File "/usr/lib/python2.6/site-packages/glance/image_cache/prefetcher.py", line 80, in run
    successes = sum([1 for r in results if r is True])
  File "/usr/lib/python2.6/site-packages/eventlet/greenpool.py", line 232, in next
    val = self.waiters.get().wait()
  File "/usr/lib/python2.6/site-packages/eventlet/greenthread.py", line 166, in wait
    return self._exit_event.wait()
  File "/usr/lib/python2.6/site-packages/eventlet/event.py", line 120, in wait
    current.throw(*self._exc)
  File "/usr/lib/python2.6/site-packages/eventlet/greenthread.py", line 192, in main
    result = function(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/image_cache/prefetcher.py", line 53, in fetch_image_into_cache
    image_meta = registry.get_image_metadata(ctx, image_id)
  File "/usr/lib/python2.6/site-packages/glance/registry/__init__.py", line 133, in get_image_metadata
    return c.get_image(image_id)
  File "/usr/lib/python2.6/site-packages/glance/registry/client.py", line 121, in get_image
    res = self.do_request("GET", "/images/%s" % image_id)
  File "/usr/lib/python2.6/site-packages/glance/registry/client.py", line 89, in do_request
    action, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 63, in wrapped
    return func(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 440, in do_request
    self._authenticate()
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 418, in _authenticate
    auth_plugin.authenticate()
  File "/usr/lib/python2.6/site-packages/glance/common/auth.py", line 125, in authenticate
    self.check_auth_params()
  File "/usr/lib/python2.6/site-packages/glance/common/auth.py", line 94, in check_auth_params
    if self.creds['auth_url'].rstrip('/').endswith('v2.0'):
AttributeError: 'NoneType' object has no attribute 'rstrip'

Expected results:

A nice error message requesting auth parameters

Changed in glance:
assignee: nobody → Flavio Percoco Premoli (flaper87)
Changed in glance:
importance: Undecided → High
Changed in glance:
status: New → In Progress
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/24977

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

Reviewed: https://review.openstack.org/24977
Committed: http://github.com/openstack/glance/commit/855162b0b1fc62b60f0f350d3258334711e12aec
Submitter: Jenkins
Branch: master

commit 855162b0b1fc62b60f0f350d3258334711e12aec
Author: Flaper Fesp <email address hidden>
Date: Thu Mar 21 10:05:05 2013 +0100

    Check if creds are present and not None

    Currently, KeystoneStrategy checks whether the required credentials are
    present in the creds dict but it doesn't check whether they are valid or
    not.

    This patch checks whether the required creds are present and not None
    otherwise a MissingCredentials exception will be raised.

    Note: No need for checking parameters' values types since they'll be
    instances of basestring once set otherwise they'll be None.

    Fixes bug 1157765

    Change-Id: I664a604c3cbf2fca60a88c4d887cd9a4b678c8a5

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

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/25369

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

Fix proposed to branch: milestone-proposed
Review: https://review.openstack.org/25371

Thierry Carrez (ttx)
tags: added: grizzly-rc-potential
Revision history for this message
Flavio Percoco (flaper87) wrote :

Hi,

I propose removing the grizzly-rc-potential tag. I pushed for review a patch in milestone-proposed and then realized that patches proposed there should be "release blockers" and this is definitely not!

Waiting for stable/grizzly makes more sense!

Sorry for the confusion, I already abandoned the milestone-proposed review!

Revision history for this message
Mark Washenberger (markwash) wrote :

I'm not a veteran of this particular part of the process yet, but it seems to me this would be a fine fix to include in the final rc.

Revision history for this message
Flavio Percoco (flaper87) wrote :

If there will be a new Glance RC then it makes sense to leave the tag and restore the patch. Just wanted to make sure this bug wouldn't block the release.

Thierry Carrez (ttx)
Changed in glance:
importance: High → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (stable/folsom)

Reviewed: https://review.openstack.org/25369
Committed: http://github.com/openstack/glance/commit/5b4d21d8f97c2c83222893b3b585f80d2108e8bf
Submitter: Jenkins
Branch: stable/folsom

commit 5b4d21d8f97c2c83222893b3b585f80d2108e8bf
Author: Flaper Fesp <email address hidden>
Date: Thu Mar 21 10:05:05 2013 +0100

    Check if creds are present and not None

    Currently, KeystoneStrategy checks whether the required credentials are
    present in the creds dict but it doesn't check whether they are valid or
    not.

    This patch checks whether the required creds are present and not None
    otherwise a MissingCredentials exception will be raised.

    Note: No need for checking parameters' values types since they'll be
    instances of basestring once set otherwise they'll be None.

    Fixes bug 1157765

    Change-Id: I664a604c3cbf2fca60a88c4d887cd9a4b678c8a5

tags: added: in-stable-folsom
Thierry Carrez (ttx)
Changed in glance:
milestone: none → grizzly-rc2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (milestone-proposed)

Reviewed: https://review.openstack.org/25371
Committed: http://github.com/openstack/glance/commit/9f336df06409b4e37e1737978cf7187a4172ca74
Submitter: Jenkins
Branch: milestone-proposed

commit 9f336df06409b4e37e1737978cf7187a4172ca74
Author: Flaper Fesp <email address hidden>
Date: Thu Mar 21 10:05:05 2013 +0100

    Check if creds are present and not None

    Currently, KeystoneStrategy checks whether the required credentials are
    present in the creds dict but it doesn't check whether they are valid or
    not.

    This patch checks whether the required creds are present and not None
    otherwise a MissingCredentials exception will be raised.

    Note: No need for checking parameters' values types since they'll be
    instances of basestring once set otherwise they'll be None.

    Fixes bug 1157765

    Change-Id: I664a604c3cbf2fca60a88c4d887cd9a4b678c8a5
    (cherry picked from commit 855162b0b1fc62b60f0f350d3258334711e12aec)

Changed in glance:
status: Fix Committed → Fix Released
Mark McLoughlin (markmc)
tags: removed: in-stable-folsom
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers