Booting from volumes

Booting from a Cinder volume gives a number of benefits as an OpenStack Operator. You can provide a level of resiliency to your instances, or you can enable Live-Migration of an instance where you are not counting on Libvirt to migrate the disk for you.

Getting ready

Ensure you are logged in to the Ubuntu host where the cinder command-line utilities are installed and source your OpenStack environment admin credentials.

How to do it...

To boot an instance from a volume, we first need to select an image to boot from as well as a flavor of our choice. The steps are follows:

  1. Get the UUID of the image to boot:
    nova image-list
    

    The command generates the following output:

    How to do it...
  2. Get the flavor ID for m1.tiny:
    nova flavor-list
    

    The command generates the following output:

    How to do it...
  3. Since our lab environment is configured with two networks, we will need to choose the network to attach our instance to. First, list available networks:
    neutron net-list
    

    The available networks will be displayed:

    How to do it...
  4. Finally, we issue the nova boot command:
    nova boot 
        --flavor m1.tiny 
        --block-device source=image,id=trusty-image,shutdown=preserve,dest=volume,size=15,bootindex=0 
       --key_name demokey 
        --nic net-id=03575e772-b021-425c-bc17-5a3263247fb8 
        --config-drive=true 
        CookBook_Instance
    

How it works...

As you can see, in the final step we passed a lot of new parameters to nova boot to tell Nova to use Cinder while booting the image. Specifically, --block-device, along with its sub-parameters source, id, shutdown, destination, size, and boot index, tell Nova to boot from a specific image (source and id), to preserve the Cinder volume when you shutdown the instance (shutdown), and that the destination is to be a cinder-volume of a specific size (dest and size).

..................Content has been hidden....................

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