- Ceph Cookbook
- Karan Singh
- 212字
- 2025-02-21 19:10:13
Configuring Nova to boot instances from Ceph RBD
In order to boot all OpenStack instances into Ceph, that is, for the boot-from-volume feature, we should configure an ephemeral backend for nova. To do this, edit /etc/nova/nova.conf
on the OpenStack node and perform the following changes.
How to do it…
This recipe deals with configuring Nova to store entire virtual machines on the Ceph RBD:
- Navigate to the
[libvirt]
section and add the following:inject_partition=-2 images_type=rbd images_rbd_pool=vms images_rbd_ceph_conf=/etc/ceph/ceph.conf
- Verify your changes:
# cat /etc/nova/nova.conf|egrep "rbd|partition" | grep -v "#"
- Restart the OpenStack nova services:
# service openstack-nova-compute restart
- To boot a virtual machine in Ceph, the glance image format must be RAW. We will use the same
cirros
image that we downloaded earlier in this chapter and convert this image from the QCOW to RAW format (this is important). You can also use any other image, as long as it's in the RAW format:# qemu-img convert -f qcow2 -O raw cirros-0.3.1-x86_64-disk.img cirros-0.3.1-x86_64-disk.raw
- Create a glance image using a RAW image:
# glance image-create --name cirros_raw_image --is-public=true --disk-format=raw --container-format=bare < cirros-0.3.1-x86_64-disk.raw
- To test the boot from the Ceph volume feature, create a bootable volume:
# nova image-list # cinder create --image-id ff8d9729-5505-4d2a-94ad-7154c6085c97 --display-name cirros-ceph-boot-volume 1
- List cinder volumes to check if the bootable field is
true
:# cinder list
- Now, we have a bootable volume, which is stored on Ceph, so let's launch an instance with this volume:
# nova boot --flavor 1 --block_device_mapping vda=fd56314b-e19b-4129-af77-e6adf229c536::0 --image 964bd077-7b43-46eb-8fe1-cd979a3370df vm2_on_ceph --block_device_mapping vda = <cinder bootable volume id > --image = <Glance image associated with the bootable volume>
- Finally, check the instance status:
# nova list
- At this point, we have an instance running from a Ceph volume. Try to log in to the instance from the horizon dashboard: