Thursday 2 April 2015

Mini-HOWTO:
OpenStack & Thin Provisioning on RHEL/CentOS 7


This time it's just the mini how-to with some proposal for a fix.

If you are OpenStack user, you may meet the issue that when you create a thin provisioned volume from an image, it takes too long time than expected and the volume becomes too far from being "thin", even if the volume is marked as thin provisioned. Of course you could manually try to reclaim the unused space but it would take extra steps and some time.


So, if you want to save your time (and the utilization of the storage) and you can have a look at the list of OpenStack (Linux) processes, then the qemu-img seems "a very good" suspect of the issue. You may be right, because it's very probably that your block storage needs a special command for the proper thin provisioning and doesn't receive these commands from the qemu-img utility.

OpenStack (its Cinder component) uses qemu-img to transfer a data between images and volumes (e.g. iSCSI). For SCSI protocols the missing commands may be UNMAP or WRITE SAME (with UNMAP bit).

The commands have been supported by QEMU since version 1.5, but the qemu-img (the convert feature) supports them "by default" only since version 2.0. Also the later versions of QEMU bring some more improvements in there.

But RHEL/CentOS 7 (and 7.1 too) has the qemu-img at version 1.5.3 what obviously can cause the issue. Red Hat within the latest products - e.g. OpenStack Platform 6.0.1 (the latest one) - provides qemu-img 2.1.2 (the new package name is qemu-img-rhev). For those ppl which need the proper thin provisioning just for testing purposes and don't have the access to RHEL OSP 6.0.1, I have prepared the qemu-img 2.1.3 package. The rpm is based on the sources from Fedora 21 updates.

I would recommend to install the package in the OpenStack node without QEMU installed as hypervisor. For example, the installation may look like below:


Finally you should be able to create new volumes from images where the new volumes are actually thin provisioned since they are created. So, have a nice provisioning! ;-)

As usually, any substantive comments, questions, requests or errata (related to my post) are very welcome. 

A few references/links: