Configuring Glance for Ceph backend

We have completed the configuration required from the Ceph side. In this recipe, we will configure the OpenStack glance to use Ceph as a storage backend.

How to do it…

This recipe talks about configuring the glance component of OpenStack to store virtual machine images on Ceph RBD:

  1. Log in to os-node1, which is our glance node, and edit /etc/glance/glance-api.conf for the following changes:
    1. Under the [DEFAULT] section, make sure that the following lines are present:
      default_store=rbd
      show_image_direct_url=True
    2. Execute the following command to verify entries:
      # cat /etc/glance/glance-api.conf | egrep -i "default_store|image_direct"
      
    3. Under the [glance_store] section, make sure that the following lines are present under RBD Store Options:
      stores = rbd
      rbd_store_ceph_conf=/etc/ceph/ceph.conf
      rbd_store_user=glance
      rbd_store_pool=images
      rbd_store_chunk_size=8
    4. Execute the following command to verify the previous entries:
      # cat /etc/glance/glance-api.conf | egrep -v "#|default" | grep -i rbd
      
  2. Restart the OpenStack glance services:
    # service openstack-glance-api restart
    
  3. Source the keystone_admin file for OpenStack and list the glance images:
    # source /root/keystonerc_admin
    # glance image-list
    
  4. Download the cirros image from the Internet, which will later be stored in Ceph:
    # wget http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img
    
  5. Add a new glance image using the following command:
    # glance image-create --name cirros_image --is-public=true --disk-format=qcow2 --container-format=bare < cirros-0.3.1-x86_64-disk.img
    
  6. List the glance images using the following command; you will notice there are now two glance images:
    # glance image-list
    
  7. You can verify that the new image is stored in Ceph by querying the image ID in the Ceph images pool:
    # rados -p images ls --name client.glance --keyring /etc/ceph/ceph.client.glance.keyring | grep -i id
    
  8. Since we have configured glance to use Ceph for its default storage, all the glance images will now be stored in Ceph. You can also try creating images from the OpenStack horizon dashboard:
  9. Finally, we will try to launch an instance using the image that we have created earlier:
    # nova boot --flavor 1 --image b2d15e34-7712-4f1d-b48d-48b924e79b0c vm1
    
    Note

    While you are adding new glance images or creating an instance from the glance image stored on Ceph, you can check the IO on the Ceph cluster by monitoring it using the # watch ceph -s command.