OpenStack Glance NFS and Compute local direct fetch

This feature has been around for quite a while now, if I remember correctly it was introduced in the Grizzly release. However, I never really got the chance to play around with it. Let’s assume that you use NFS to store Glance images, we know that the default booting mechanism implies to fetch the instance image from Glance to the Nova compute. This is basically streaming the image which involves network throughput and makes the boot process longer. OpenStack Nova can be configured to directly access Glance images from a local filesystem path. This is ideal for our NFS scenario.

The setup is a bit tricky, so first configure your glance-api.conf and apply the following flags:

show_multiple_locations = True
filesystem_store_metadata_file = /etc/glance/nfs.json

Create your /etc/glance/nfs.json file:

    "id": "f5e1eee7-9160-493e-9b6f-d4b1c34eaa23",
    "mountpoint": "/srv/nfs/glance/"

Make sure to restart both Glance API and registry.

Now, in your nova.conf on your compute nodes only, append the following values in the appropriate sections:

allowed_direct_url_schemes = file

filesystems = nfs

id = f5e1eee7-9160-493e-9b6f-d4b1c34eaa23
mountpoint = /srv/nfs/glance/

During the boot sequence, Nova will issue a cp instead of fetching the Glance image through the network. Et voilà!