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:

  1. 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
  2. Verify your changes:
    # cat /etc/nova/nova.conf|egrep "rbd|partition" | grep -v "#"
    
    How to do it…
  3. Restart the OpenStack nova services:
    # service openstack-nova-compute restart
    
  4. 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
    
    How to do it…
  5. 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
  6. 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
    
    How to do it…
  7. List cinder volumes to check if the bootable field is true:
    # cinder list
    
    How to do it…
  8. 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>
    
  9. Finally, check the instance status:
    # nova list
    
    How to do it…
  10. At this point, we have an instance running from a Ceph volume. Try to log in to the instance from the horizon dashboard:
    How to do it…
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.45.5