pruner caches raised NoneType exception

Bug #1039854 reported by Zhou ShaoYu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Brian Waldon

Bug Description

Set image_cache_max_size = 1 and cache some images which size bigger than image_cache_max_size,
and then run command glance-cache-pruner.
It raised exception NoneType:
Traceback (most recent call last):
  File "/usr/local/bin/glance-cache-pruner", line 7, in <module>
    execfile(__file__)
  File "/root/glance-2012.2/bin/glance-cache-pruner", line 54, in <module>
    app.run()
  File "/root/glance-2012.2/glance/image_cache/pruner.py", line 28, in run
    self.cache.prune()
  File "/root/glance-2012.2/glance/image_cache/__init__.py", line 186, in prune
    entry = self.driver.get_least_recently_accessed()
  File "/root/glance-2012.2/glance/image_cache/drivers/sqlite.py", line 275, in get_least_recently_accessed
    image_id = cur.fetchone()[0]
TypeError: 'NoneType' object has no attribute '__getitem__'

It's not fixed in folsom.

By the way,does it have config option for auto pruner image cache when glance cache a new image?I can cache images without max_size restricted.

Revision history for this message
Zhou ShaoYu (hzzhoushaoyu) wrote :
Brian Waldon (bcwaldon)
Changed in glance:
assignee: nobody → Brian Waldon (bcwaldon)
Brian Waldon (bcwaldon)
Changed in glance:
status: New → In Progress
milestone: none → folsom-rc1
importance: Undecided → Medium
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/12174

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

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

commit abcff5b5f5b2b89bf788f6e5447a85c320e5a26c
Author: Brian Waldon <email address hidden>
Date: Wed Aug 29 21:17:46 2012 -0700

    Catch pruner exception when no images are cached

    This handles a situation where the pruner would raise an exception when
    the image_cache_max_size was set lower than the size of the last image.

    Fixes bug 1039854

    Change-Id: I4a6c164e9f821f1250314974f829f058fbd02863

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