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:
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
To create a host aggregate called TestAggregate
that consists of a compute host called compute-02
, carry out the following steps:
nova aggregate-create TestAggregate
This produces the following output:
nova host-list
The preceding command will result in the following output:
nova aggregate-add-host TestAggregate compute-02
This will give the following output if it was successful:
nova aggregate-list
This will give the following output:
nova aggregate-details TestAggregate
This will give the following details:
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:
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
TestAggregate
aggregate with the following command:nova flavor-key m1.highspec set highspec=true
nova flavor-show m1.highspec
This will give you the following output:
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.
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.