
上QQ阅读APP看书,第一时间看更新
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:
- Log in to
os-node1
, which is our glance node, and edit/etc/glance/glance-api.conf
for the following changes:- Under the
[DEFAULT]
section, make sure that the following lines are present:default_store=rbd show_image_direct_url=True
- Execute the following command to verify entries:
# cat /etc/glance/glance-api.conf | egrep -i "default_store|image_direct"
- 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
- Execute the following command to verify the previous entries:
# cat /etc/glance/glance-api.conf | egrep -v "#|default" | grep -i rbd
- Under the
- Restart the OpenStack glance services:
# service openstack-glance-api restart
- Source the
keystone_admin
file for OpenStack and list the glance images:# source /root/keystonerc_admin # glance image-list
- 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
- 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
- List the glance images using the following command; you will notice there are now two glance images:
# glance image-list
- 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
- 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:
- 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.