Defining host aggregates

Host aggregates allow us to logically group hardware and create partitions in our deployment. Host aggregates are often used to group same specification hardware together, such as Compute hosts that have a certain type of hardware such as SSDs available. We can then define extra pieces of information associated with that grouping of hardware (known as metadata), which is exposed to a user when launching instances. For example, we can launch an instance and specify that we want it to run on compute hosts that have SSDs. By supplying this extra information, the compute hosts that understand this metadata will request that the instance be launched on that hardware.

Compute hosts can also belong to more than one host aggregate. This allows for greater flexibility when defining the partitions by allowing compute hosts to be organized in multiple ways. The following diagram shows an example of using host aggregate to define groups of Compute resource. Only an administrator can create host aggregates:

Defining host aggregates

Getting ready

Ensure that you are logged onto an Ubuntu host that has access to our OpenStack environment on the 192.168.100.0/24 public network. This host will be used to run client tools against the OpenStack environment created. If you are using the accompanying Vagrant environment, as described in the Preface, you can use the controller node. This node has the python-novaclient package installed that provides the swift command-line client.

If you created this node with Vagrant, you can execute the following command:

vagrant ssh controller 

Ensure you have set the following credentials (adjust the path to your certificates and key file to match your environment if not using the Vagrant environment):

export OS_TENANT_NAME=cookbook
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=https://192.168.100.200:5000/v2.0/
export OS_NO_CACHE=1
export OS_KEY=/vagrant/cakey.pem
export OS_CACERT=/vagrant/ca.pem

How to do it...

To create a host aggregate called TestAggregate that consists of a compute host called compute-02, carry out the following steps:

  1. We first create the host aggregate, using the following command:
    nova aggregate-create TestAggregate
    

    This produces the following output:

    How to do it...
  2. To find out the specific hostname we should use for our host aggregate, issue the following command:
    nova host-list
    

    The preceding command will result in the following output:

    How to do it...
  3. With the host aggregate created and name of our host recorded, we can simply add our hosts to this aggregate as follows:
    nova aggregate-add-host TestAggregate compute-02
    

    This will give the following output if it was successful:

    How to do it...
  4. We can list the available host aggregates in our environment by issuing the following command:
    nova aggregate-list
    

    This will give the following output:

    How to do it...
  5. We can get further information about an aggregate, such as which hosts are in the aggregate, any metadata associated with it, and whether or not any availability zones are associated with it, by issuing the following command:
    nova aggregate-details TestAggregate
    

    This will give the following details:

    How to do it...
  6. To define metadata for a host aggregate such that we can later use this extra metadata information to direct our instances to be launched on a host in this group, use the following command:
    nova aggregate-set-metadata TestAggregate highspec=true
    

    This sets the information highspec=true, which will be used later on. The command produces the following output:

    How to do it...
  7. We can then expose this metadata through the flavors used to launch the instances. To demonstrate this, we will create a flavor called m1.highspec and set the metadata on this to match the metadata for our host aggregate. Use the following commands to create a new flavor called m1.highspec:
    nova flavor-create 
        m1.highspec 
        50 2048 20 2
        --is-public=true
    
  8. We can set extra information on this flavor to match the metadata set on the TestAggregate aggregate with the following command:
    nova flavor-key m1.highspec set highspec=true
    
  9. We can then view the details of this flavor with the following command:
    nova flavor-show m1.highspec
    

    This will give you the following output:

    How to do it...

    We can specify this flavor when launching an instance. This will automatically schedule to one of the instances in the TestAggregate aggregate, which will be compute-02 in this example.

How it works...

Host Aggregates allow an administrator to define compute resources in a way that is transparent to the end user but group them logically according to their purpose. When metadata is added to an aggregate that matches a flavor's metadata, and when that flavor is used to launch an instance, the instance will be scheduled to run on the compute hosts that have been assigned that to that aggregate.

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

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