Neutron DHCP Agents Availability Zone Awareness

In large deployments requiring High Availability, it is crucial to ensure that the network agents and in particular for this document, the DHCP agent, run on different Availability Zones.

Nova AZ is not Neutron AZ

Logically, an AZ is the same concept between Nova and Neutron, but functionally, they do not have any relation. This means that when you define AZ in Nova, it does not impact Neutron.

By default, the BaseWeightScheduler schedules networks on DHCP Agents independently of the related AZ. Even if you set AZ hints for a network, the scheduler will select agents with the fewest networks to handle to fulfill the dhcp_agents_per_network requirement.

For example, if you configure dhcp_agents_per_network = 2 and deploy 2 agents in AZ1 and 2 agents in AZ2, the scheduler may schedule the first network (net1) on both DHCP agents in AZ1 and the second network on those in AZ2.

This situation is not desirable, as if something goes wrong in AZ1, network net1 can be unreachable.

AZAwareWeightScheduler

Neutron provides a solution to make the scheduler comprehend AZs better. To achieve this, configure Neutron to use AZAwareWeightScheduler.

network_scheduler_driver = neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler
dhcp_load_type = networks

Now, the scheduler understands AZs.

The next step is to ensure that all networks are scheduled on both AZs. Set the default_availability_zones to include both AZs.

default_availability_zones = AZ1, AZ2

It is also possible to add more granularity for a network by setting hints:

For example, if you want a network to be scheduled in a specific zone, say AZ3:

openstack network create --availability-zone-hint AZ3

Conclusion

In conclusion, configuring Neutron to be AZ-aware for its agents, particularly the DHCP agent in the context of this document, is relatively straightforward. It requires minimal and non-excessive changes, yet it can significantly elevate your environment to a higher level of robustness and High Availability.