Openstack Zoning – Region/Availability Zone/Host Aggregate
Openstack cloud can be zoned from top to down levels, into Regions, Availability Zones and Host Aggregates
-Region
Each Region has its own full Openstack deployment, including its own API endpoints, networks and compute resources.
Different Regions share one set of Keystone and Horizon to provide access control and Web portal.
-Availability Zone
Inside a Region, compute nodes can be logically grouped into Availability Zones, when launching new VM instance, we can specify AZ or even a specific node in a AZ to run the VM instance.
-Host Aggregate
Besides AZ, compute nodes can also be logically grouped into Host Aggregates
Host Aggregates have meta-data to tag groups of compute nodes, e.g. we can group nodes with SSD disk to one Host Aggregate, and nodes with 10 GB NICs to another Host Aggregate.
One compute node can be put into Host Aggregate and Availability Zone and the same time, Host Aggregate has no conflict with Availability Zone.
One compute node can be put into more than one Host Aggregates
Host Aggregate is visible only to admin, for end-user, it’s exposed by creating customized flavor with Host Aggregate meta-data linked.
Note:There’s another layer of zoning – Cell, it’s introduced in Grizzly and still an experimental feature, thus it’s out of scope of this post.
Now let’s practice AZ and Host Aggregate:
1.Availability Zone
->To create AZ, it actually creates a Host Aggregate with your wanted AZ name:
nova aggregate-create aggreate-AZ-1 AZ-1
+—-+—————+——————-+——-+———-+
| Id | Name | Availability Zone | Hosts | Metadata |
+—-+—————+——————-+——-+———-+
| 4 | aggreate-AZ-1 | AZ-1 | | |
+—-+—————+——————-+——-+———-+
->Add a host to the created aggregate, this also means adding host to the new AZ, AZ-1
nova aggregate-add-host 4 compute-1
Aggregate 4 has been successfully updated.
+—-+—————+——————-+—————-+———————————+
| Id | Name | Availability Zone | Hosts | Metadata |
+—-+—————+——————-+—————-+———————————+
| 4 | aggreate-AZ-1 | AZ-1 | [u'compute-1'] | {u’availability_zone': u’AZ-1′} |
+—-+—————+——————-+—————-+———————————+
->List Availability Zones
nova availability-zone-list
+———————–+—————————————-+
| Name | Status |
+———————–+—————————————-+
| internal | available |
| |- controller-1 | |
| | |- nova-conductor | enabled :-) 2013-08-08T02:43:48.000000 |
| | |- nova-consoleauth | enabled :-) 2013-08-08T02:43:57.000000 |
| | |- nova-scheduler | enabled :-) 2013-08-08T02:43:54.000000 |
| | |- nova-cert | enabled :-) 2013-08-08T02:43:57.000000 |
| nova | available |
| |- compute-2 | |
| | |- nova-compute | enabled :-) 2013-08-08T02:43:57.000000 |
| AZ-1 | available |
| |- compute-1 | |
| | |- nova-compute | enabled :-) 2013-08-08T02:43:57.000000 |
+———————–+—————————————-+
We can see the new AZ-1 is created, and compute-1 is in it.
->Launch a VM to AZ-1 explicitly
nova boot –flavor m1.medium –image f1e5e50a-2668-4627-bcd4-769a0dbe28d3 –availability-zone AZ-1 VM-in-AZ-1
->Check if it’s running on compute-1
nova show VM-in-AZ-1
+————————————-+———————————————————-+
| Property | Value |
+————————————-+———————————————————-+
| status | ACTIVE |
| updated | 2013-08-08T02:47:21Z |
| OS-EXT-STS:task_state | None |
| OS-EXT-SRV-ATTR:host | compute-1 |
…
| OS-EXT-AZ:availability_zone | AZ-1 |
…
2.Host Aggregate
Let’s try to use Host Aggregate with meta-data, to group hosts. In the example, we create an aggregate to group the hosts with SSD disks
->Enable Host Aggregate support for novascheduler, by adding following line to /etc/nova.conf on controller node, then restart nova-* services.
scheduler_default_filters=AggregateInstanceExtraSpecsFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter
->Create an aggregate
nova aggregate-create aggregate-SSD
+—-+—————+——————-+——-+———-+
| Id | Name | Availability Zone | Hosts | Metadata |
+—-+—————+——————-+——-+———-+
| 5 | aggregate-SSD | None | | |
+—-+—————+——————-+——-+———-+
->Set a meta-data “ssd=true” to the created aggregate
nova aggregate-set-metadata 5 ssd=true
Aggregate 5 has been successfully updated.
+—-+—————+——————-+——-+——————-+
| Id | Name | Availability Zone | Hosts | Metadata |
+—-+—————+——————-+——-+——————-+
| 5 | aggregate-SSD | None | [] | {u’ssd': u’true’} |
+—-+—————+——————-+——-+——————-+
->Add a host(compute-2) to this aggregate
nova aggregate-add-host 5 compute-2
Aggregate 5 has been successfully updated.
+—-+—————+——————-+—————-+——————-+
| Id | Name | Availability Zone | Hosts | Metadata |
+—-+—————+——————-+—————-+——————-+
| 5 | aggregate-SSD | None | [u'compute-2'] | {u’ssd': u’true’} |
+—-+—————+——————-+—————-+——————-+
->Create a new flavor
nova flavor-create m1.ssd auto 4096 10 2 –is-public true
+————————————–+——–+———–+——+———–+——+——-+————-+———–+————-+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+————————————–+——–+———–+——+———–+——+——-+————-+———–+————-+
| f9a0c0d8-161d-48be-8161-b2f33df0391d | m1.ssd | 4096 | 10 | 0 | | 2 | 1.0 | True | {} |
+————————————–+——–+———–+——+———–+——+——-+————-+———–+————-+
->Create flavor key-value to match meta-data of the aggregate
nova flavor-key m1.ssd set ssd=true
->From the nova flavor-list , we can see the key-value is in “extra_specs” already
nova flavor-list
+————————————–+———–+———–+——+———–+——+——-+————-+———–+——————-+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+————————————–+———–+———–+——+———–+——+——-+————-+———–+——————-+
| 1 | m1.tiny | 512 | 0 | 0 | | 1 | 1.0 | True | {} |
| 487fac6c-4ee2-49c8-b117-717fe05a50f5 | m1.medium | 4096 | 10 | 0 | | 2 | 1.0 | True | {} |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | {} |
| af6f872e-748b-4f14-9455-36dcc3840407 | m1.small | 2048 | 10 | 0 | | 1 | 1.0 | True | {} |
| d2890833-8230-4e4f-9259-525230db255a | m1.large | 8192 | 20 | 10 | | 4 | 1.0 | True | {} |
| f9a0c0d8-161d-48be-8161-b2f33df0391d | m1.ssd | 4096 | 10 | 0 | | 2 | 1.0 | True | {u’ssd': u’true’} |
+————————————–+———–+———–+——+———–+——+——-+————-+———–+——————-+
->Launch a VM with this new created flavor
nova boot –flavor m1.ssd –image f1e5e50a-2668-4627-bcd4-769a0dbe28d3 vm-flavor-m1.ssd
->Check if it’s running on host compute-2
nova show vm-flavor-m1.ssd
+————————————-+———————————————————-+
| Property | Value |
+————————————-+———————————————————-+
| status | ACTIVE |
| updated | 2013-08-08T03:33:37Z |
| OS-EXT-STS:task_state | None |
| OS-EXT-SRV-ATTR:host | compute-2 |