diff options
author | Jay Pipes <jaypipes@gmail.com> | 2011-10-21 16:10:32 -0400 |
---|---|---|
committer | Jay Pipes <jaypipes@gmail.com> | 2011-10-25 12:54:31 -0400 |
commit | 39c855743423175beca6955ed30c15b9c40f9129 (patch) | |
tree | 8e76e5a7f3c712b8ff78310b9898a80c5b912d9f /glance/tests/stubs.py | |
parent | d521d6529e0d0cdd1138823e0ee5be0e5d87e21c (diff) | |
download | glance-39c855743423175beca6955ed30c15b9c40f9129.tar.gz |
Adds Driver Layer to Image Cache
Fixes LP Bug#879136 - keyerror: 'image' when doing nova image-list
Fixes LP Bug#819936 - New image cache breaks Glance on Windows
This patch refactors the image cache further by adding an
adaptable driver layer to the cache. The existing filesystem-based
driver that depended on python-xattr and conditional fstab support
has been moved to /glance/image_cache/drivers/xattr.py, and a new
default driver is now based on SQLite and has no special requirements.
The image cache now contains a simple interface for pruning the
cache. Instead of the logic being contained in
/glance/image_cache/pruner.py, now the prune logic is self-contained
within the ImageCache.prune() method, with pruning calling the
simple well-defined driver methods of get_least_recently_accessed()
and get_cache_size().
Adds a functional test case for the caching middleware and adds
documentation on how to configure the image cache drivers.
TODO: cache-manage middleware...
TODO: cache management docs
Change-Id: Id7ae73549d6bb39222eb7ac0427b0083fd1af3ec
Diffstat (limited to 'glance/tests/stubs.py')
-rw-r--r-- | glance/tests/stubs.py | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/glance/tests/stubs.py b/glance/tests/stubs.py index 30d084f9f..c2f7f2e6c 100644 --- a/glance/tests/stubs.py +++ b/glance/tests/stubs.py @@ -17,27 +17,17 @@ """Stubouts, mocks and fixtures for the test suite""" -import datetime -import httplib -import operator import os import shutil -import StringIO -import sys -import stubout import webob +from glance.api import v1 as server +from glance.api.middleware import version_negotiation import glance.common.client from glance.common import context from glance.common import exception from glance.registry.api import v1 as rserver -from glance.api import v1 as server -from glance.api.middleware import version_negotiation -import glance.store -import glance.store.filesystem -import glance.store.http -import glance.registry.db.api FAKE_FILESYSTEM_ROOTDIR = os.path.join('/tmp', 'glance-tests') @@ -199,7 +189,7 @@ def stub_out_registry_and_store_server(stubs): fake_image_iter) -def stub_out_registry_server(stubs): +def stub_out_registry_server(stubs, **kwargs): """ Mocks calls to 127.0.0.1 on 9191 for testing so that a real Glance Registry server does not need to be up and @@ -226,8 +216,7 @@ def stub_out_registry_server(stubs): self.req.body = body def getresponse(self): - sql_connection = os.environ.get('GLANCE_SQL_CONNECTION', - "sqlite:///") + sql_connection = kwargs.get('sql_connection', "sqlite:///") context_class = 'glance.registry.context.RequestContext' options = {'sql_connection': sql_connection, 'verbose': VERBOSE, 'debug': DEBUG, 'context_class': context_class} |