Saturday, October 4, 2014

Use thin clone in OpenStack

As a shared/block storage user in VMware environment, I like the feature that we can clone a virtual machine (VM) from another VM or template. It's simply a process of choosing a new VM name, host, datastore, clicking finish and done. Wait... it's done from the admin point of view. The task itself in fact will be queued and executed in the "Recent Tasks" view. Depending on how big is your VM and storage efficiency, it can take several minutes or up to hours before the newly cloned VM can be utilized. The complains are:

    1. Slow - especially if you're cloning many of them at the same time
    2. No space efficiency - each clone is a full copy of the original VM
    3. Can't choose thin clone - need VMware Horizon/View license or customized app
    4. Even thick clone needs the vCenter license

Don't get me wrong. vCenter and ESX are great products and very stable. However, in a development engineering lab, I prefer it to be:

    1. Cost effective - pay as less as possible
    2. Fast - so we can try/validate more crazy ideas
    3. Easy - easy to find my template and image, and easy to clone by a click or a few API calls
    4. Efficient - share storage space as much as possible

and that's why and when I migrate my dev lab from VMware to OpenStack and Nimble. Here's how a VM/instance is launched in the lab:

First step: Launch an image instance by using a boot volume

Locate the image ID through glance image-list:

# glance image-list

My Ubuntu 14.04 image id is ffc286d5-6fbd-44c0-8ea9-89667599c901. Launch a Ubuntu 14.04 boot volume instance by using nova boot:


# nova boot u1404 --flavor m1.medium --block-device source=image,dest=volume,id=ffc286d5-6fbd-44c0-8ea9-89667599c901,size=2,shutdown=preserve,bootindex=0

Or use Horizon if GUI is preferred:




After click "Launch", a Ubuntu instance will be created. It's boot from a Nimble volume so it can take advantages of Nimble's, snapshot, performance and reliability. That's it. There's only one step in the process. However, where's the fast and storage space efficiency parts? The image needs to be downloaded to the boot volume, and how can the subsequent Ubuntu 14.04 instances start taking advantage of the thin clone?

Yes, the first image boot volume will take the hit of downloading bits from Glance to the boot volume. After it completes, Nimble Cinder driver implementation will tag the Nimble volume with a snapshot. It associates the Ubuntu image with the volume snapshot. When the next nova boot request coming in, it'll simply clone a volume out of the snapshot without downloading the image from Glance. Imagine to create a 40 GB image instance. By using this feature, it can be cloned out from a Nimble volume snapshot immediately and with zero volume usage. All can be achieved by using the same and single nova boot command or GUI. It's perfect for engineers in the development and QA lab.

As a user I might ask: if some instances are clones, does it mean that I can't delete the parent instance when cloned instances are in use? It turns out that the Nimble Cinder driver implementation keeps track of this for you. I can delete any instance from Nova, business as usual. If the instance is backed by a parent volume and I try to delete it, Nimble Cinder driver will offline the volume if there are clones. It'll delete it automatically when there's no clones eventually.

This feature in the Nimble Cinder driver is turned off by default. To enable this feature, insert the following line in the cinder.conf:

nimble_ito_enabled=true

No comments:

Post a Comment