]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Generic image-volume cache
authorPatrick East <patrick.east@purestorage.com>
Wed, 8 Jul 2015 00:23:58 +0000 (17:23 -0700)
committerWalter A. Boring IV (hemna) <walter.boring@hp.com>
Wed, 2 Sep 2015 17:54:07 +0000 (17:54 +0000)
commit15c13f8aed3a9b65299cd5eac4144dc3bbcbb820
tree4a4df0eca07fa7a4a22998a82659a489f026babe
parentf9e7140d0c71c8f0e920b07ae1a834d48a68567d
Generic image-volume cache

This introduces a new feature for backends to be able to use cached
glance images when creating volumes from images.

If enabled, and the cinder internal tenant is configured, it will
create a minimal sized clone of a volume the first time it is
downloaded from glance. A new db table ‘image_volume_cache’ tracks
these volumes, which are owned by the Cinder internal tenant. The
original will then be extended to full size. Any subsequent requests to
create a volume from an image will be able to do a volume clone from
the image-volume cache entry instead of downloading the image data from
glance again.

In the future we could create an entry upon creating an image from a
volume right before uploading the volume to glance. This version
however does not aim to do more than add the initial framework and
help with subsequent image downloads. There are certainly more
improvements that can be done over time on top of this.

These image-volumes are host specific, so each backend may end up with
its very own image-volume to do clones from.

The cache is limited in size by number of entries allowed and size in
gb. When creating a new entry if space is needed the last used entries
will be evicted to make room.

In the current implementation the image-volumes will be viewable by a
cloud admin in the volume list, and show up as owned by the Cinder
internal tenant. They can safely be deleted manually by an admin, this
will cause the entry to be removed from the cache. These volumes will
use quota for the internal tenant.

Cache actions will post notifications to Ceilometer. There are
notifications like ‘image_volume_cache.miss’, ‘image_volume_cache.hit’,
and ‘image_volume_cache.evict’. A change will be required to the
event_definitions.yaml to see them nicely. Until then you only need to
add a new event type 'image_volume_cache.*' and look for the ‘image_id’
and ‘host’ fields.

DocImpact: We probably want some instructions on restrictions of the
cache and how to use it. The three new config options should also be
documented somewhere: ‘image_volume_cache_enabled’,
’image_volume_cache_max_size_gb’, ‘image_volume_cache_max_size_count’

Co-Authored-By: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Implements: blueprint image-volume-cache
Change-Id: If22bbaff89251e4e82a715170a48b4040f95c09f
17 files changed:
cinder/db/api.py
cinder/db/sqlalchemy/api.py
cinder/db/sqlalchemy/migrate_repo/versions/055_add_image_volume_cache_table.py [new file with mode: 0644]
cinder/db/sqlalchemy/models.py
cinder/image/cache.py [new file with mode: 0644]
cinder/tests/unit/image/fake.py
cinder/tests/unit/image/test_cache.py [new file with mode: 0644]
cinder/tests/unit/test_db_api.py
cinder/tests/unit/test_migrations.py
cinder/tests/unit/test_rbd.py
cinder/tests/unit/test_volume.py
cinder/tests/unit/utils.py
cinder/tests/unit/volume/flows/test_create_volume_flow.py
cinder/volume/api.py
cinder/volume/driver.py
cinder/volume/flows/manager/create_volume.py
cinder/volume/manager.py