The purpose of this lab is to show how to use the Pure Storage Glance Image Cache for OpenStack Cinder.
vTeam Specialization Program
Pure Storage nominated me recently to join the Pure Storage vTeam Specialization program for New Stack. The idea behind the program is, to create an active community within Pure Storage. Allowing Puritans to learn and develop their skills and grow into a subject matter experts.
The program consists of training and lab exercises that are focussed on developing experience in the New Stack space (Kubernetes, Ansible, Open Stack and more).
Since I think there are more people out there how want to learn more about New Stack, I will blog my progress in a series of lab exercises.
The purpose of this lab is to use variables and facts from Ansible for building a more dynamic playbook.
|Name:||Glance Image Cache for Cinder|
|Description:||Use the Glance Image Cache for Cinder|
|Objective:||Configure Glance Image Cache on a FlashArray|
|Task #1:||Configure a backend to use this feature|
|Task #2:||Create a Nova Cinder-based boot volume using a Glance image|
|Task #3:||Ensure the Nova volume is created together with a Gold image volume|
|Task #4:||Create another Nova instance using the same Glance image|
|Task #5:||Check the new FlashArray volume is a clone of the Gold image|
|Success Criteria:||Nova boot volumes successfully clone from a Gold image on the FlashArray|
In this lab, I will build on the DevStack environment that I’ve setup earlier here.
Glance Image Cache for Cinder
Glance image cache allows the storage backend for OpenStack cinder to speed up the deployment of images, by creating a so-called gold copy. In the case of FlashArray this gold copy is a volume which can be easily cloned. This way the image doesn’t need to be copied, but the clone activity is offloaded to the storage array. This article provides a lot more background information on the implementation.
Create user and project
For the cache to work we need to create a dedicated user and project where the image cache volumes are created. Users do not need access to this project or need to see it. Therefor we’ll create a dedicated project and user and configure those for the glance image cache.
To do this the first step is to set the environment variables on DevStack, which is required to run de OpenStack command line utilities.
cd ~/devstack source accrc/admin/admin
Once the environment settings are loaded, we can now create the project for glance cache.
openstack project create --domain default --description "Cinder Internal Tenant Project" cinder_internal_project
And the user:
openstack user create --domain default --password-prompt cinder_internal_project
Finally we add a role, where we give the user access to the project.
openstack role add --project cinder_internal_project --user cinder_internal_project member
Enable cache for Cinder backend
No that we have our user and project setup, we need to configure our Cinder backend to use the Glance cache.
cinder.conf from the
/etc/cinder/cinder.conf directory. Add the following two lines to the
DEFAULT section to inform Cinder about the project and user we’ll be using for Glance image cache:
[DEFAULT] ... cinder_internal_tenant_project_id = cinder_internal_project cinder_internal_tenant_user_id = cinder_internal_project
Next we want to configure our Pure Storage backend(s), by setting
True and specifying the limits for Glance Image cache as shown below:
[puredriver-1] ... image_volume_cache_enabled = True image_volume_cache_max_size_gb = 200 image_volume_cache_max_count = 50
Now we need to restart Cinder to activate the mew backend settings.
sudo systemctl restart email@example.com
Test Glance image cache
To test Glance cache we can simply create a new volume from a project. When creating the volume, make sure to select Image as Volume Source. For this example, I’ll use the default
cirros image shipped with DevStack.
This will create the new volume, but if we navigate to the Admin section, we can see the command actually created two volumes. The volume we created, but also a volume with a random name in a project called
-. This is our source volume. Any new volume from the same image will be a copy of this source volume.
If we now login to the FlashArray and find the volume we created, we can see that our volume was cloned from a Source, in this case
volume-fb9cc9b5-a2f6-4afd-9e5b-89b7d9de2734-cinder. That is the proof that our Glance Image cache works and the volume was created using a storage snapshot, instead of actually copying the data.
And that is it. We’ve setup Glance Image cache for our DevStack OpenStack environment and tested it by creating a volume from an image and checking on the FlashArray that the volume was actually cloned from the Glance Image cache volume.