The power of host aggregates comes from the ability to use them to logically group hosts based on their properties. This can be used, for example, to enable load balancing, enforce physical separation, or keep instances that are insecure from being scheduled into a secured environment. We will show this by matching the metadata of a host aggregate with that of an instance flavor.
To add metadata to a host aggregate, you will need the following information:
openstack
command-line clientopenrc
file containing appropriate credentialsIn our example, these values will be the following:
cookbook-ssd-hosts
ssd=true
To add metadata to host aggregate, use the following process:
openstack aggregate show cookbook-ssd-hosts
This will bring back an output like the following. Note that the properties
field is blank if no metadata is associated yet:
openstack aggregate set --property ssd=true cookbook-ssd-hosts
openstack aggregate show cookbook-ssd-hosts
You will see that the properties
field has been updated with this information:
cookbook.ssd
that sets the expectation, which when a user select, the host will have SSDs available. This is the power of host aggregates. In the example here, compute-02
has SSDs available as we have specified this in the host aggregate named cookbook-ssd-hosts
. To take advantage of this, let's create a new flavor called cookbook.ssd
with the ssd=true
property:openstack flavor create --vcpus 1 --ram 512 --disk 5 --public cookbook.ssd
nova
command:nova flavor-key cookbook.ssd set ssd=true
cookbook.ssd
flavor, unknown to them, the instance will be restricted to the hosts within the host aggregate group that has this key/value pair set.Metadata is specified as a key/value pairing, which is then associated with a host aggregate in the Nova database. These key/value pairs are arbitrary and can be defined to match a given environment. A host aggregate can have any number of key/value pairs stored; however, this may adversely affect instance scheduling because of potentially conflicting or confusing key/value pairs.
18.191.68.18