标签:
1. 如果enable了 cache_manage middleware,可以 GET/cached-images
2. 使用glance-cache-manage
$> glance-cache-manage --host=<HOST> list-cached
3.直接查看cache目录
$> ls -lhR $IMAGE_CACHE_DIR
在devstack中,image_cache_dir = /opt/stack/data/glance/cache/
http://docs.openstack.org/developer/glance/cache.html
cache的driver有2种:
1. sqlite, cache信息存在DB中:
cur = db.execute("""SELECT
image_id, hits, last_accessed, last_modified, size
FROM cached_images
ORDER BY image_id""")
def get_cache_size(self):
计算目录大小/opt/stack/data/glance/cache/
def get_hit_count 从DB
def get_cached_images DB
def is_cached 查看文件是否存在
def is_queued 是否在/opt/stack/data/glance/cache/queue目录中
def is_being_cached 是否在/opt/stack/data/glance/cache/incomplete目录中
delete_all_cached_images 删除文件和DB信息
def queue_image 在/opt/stack/data/glance/cache/queue touch一个文件
和incomplete一起工作,实现commit/rollback
2.xattr: cache信息从文件中获取
def get_hit_count
return int(get_xattr(path, ‘hits‘, default=0))
entry[‘last_modified‘] = file_info[stat.ST_MTIME]
entry[‘last_accessed‘] = file_info[stat.ST_ATIME]
entry[‘size‘] = file_info[stat.ST_SIZE]
entry[‘hits‘] = self.get_hit_count(image_id)
标签:
原文地址:http://www.cnblogs.com/allcloud/p/4882476.html