diff --git a/defaults/main.yml b/defaults/main.yml index e997fff0..2d6db1d0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -334,6 +334,18 @@ neutron_keystone_auth_plugin: "{{ neutron_keystone_auth_type }}" neutron_keystone_auth_type: password neutron_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}" +### +### Availability zones +### +# Default availability zones do define a list of zones to where routers/agents +# will be scheduled by default. This is a list, since a deployment might stretch +# networks across AZs +neutron_default_availability_zones: [] + +# Availability zone defines current AZ of the component. For OVN you can define +# multiple AZs separated with a colon, ie "az1:az2" +neutron_availability_zone: nova + ### ### Telemetry integration ### diff --git a/releasenotes/notes/neutron_az_support-97f3ab40bf554766.yaml b/releasenotes/notes/neutron_az_support-97f3ab40bf554766.yaml new file mode 100644 index 00000000..a81597d2 --- /dev/null +++ b/releasenotes/notes/neutron_az_support-97f3ab40bf554766.yaml @@ -0,0 +1,12 @@ +--- +features: + - | + Added extra variables to Neutron role for Availability Zones configuration: + + * ``neutron_default_availability_zones`` - defines a list of AZs where + l3/dhcp agents or OVN routers/ports will be scheduled to when hint is + not provided in a request to Neutron API. + * ``neutron_availability_zone`` - Availability Zone of the current + component. It is recommended to leverage group/host_vars for setting + this variable. + For OVN this variable can contain multiple values spearated by colon. diff --git a/tasks/providers/setup_ovs_ovn.yml b/tasks/providers/setup_ovs_ovn.yml index c496350d..5bfe5d1e 100644 --- a/tasks/providers/setup_ovs_ovn.yml +++ b/tasks/providers/setup_ovs_ovn.yml @@ -22,7 +22,7 @@ - name: Set CMS Options for Gateway Scheduling changed_when: false - command: "ovs-vsctl set open . external-ids:ovn-cms-options=enable-chassis-as-gw" + command: "ovs-vsctl set Open_vSwitch . external-ids:ovn-cms-options=enable-chassis-as-gw,availability-zones={{ neutron_availability_zone }}" when: - '"neutron_ovn_gateway" in group_names' diff --git a/templates/dhcp_agent.ini.j2 b/templates/dhcp_agent.ini.j2 index eeeec60e..70302c26 100644 --- a/templates/dhcp_agent.ini.j2 +++ b/templates/dhcp_agent.ini.j2 @@ -18,3 +18,6 @@ dnsmasq_lease_max = {{ neutron_dnsmasq_lease_max }} # Metadata enable_isolated_metadata = True force_metadata = {{ neutron_dnsmasq_force_metadata }} + +[AGENT] +availability_zone = {{ neutron_availability_zone }} diff --git a/templates/l3_agent.ini.j2 b/templates/l3_agent.ini.j2 index c6e5f377..e3eb4879 100644 --- a/templates/l3_agent.ini.j2 +++ b/templates/l3_agent.ini.j2 @@ -47,7 +47,8 @@ vpn_device_driver = {{ neutron_driver_vpnaas }} {% set _ = l3_agent_plugins.append("port_forwarding") %} {% endif %} -{% if l3_agent_plugins|length > 0 %} [AGENT] +{% if l3_agent_plugins | length > 0 %} extensions = {{ l3_agent_plugins | join(',') }} {% endif %} +availability_zone = {{ neutron_availability_zone }} diff --git a/templates/neutron.conf.j2 b/templates/neutron.conf.j2 index 1f5edc88..3ae8b0c9 100644 --- a/templates/neutron.conf.j2 +++ b/templates/neutron.conf.j2 @@ -31,6 +31,15 @@ use_ssl = {{ neutron_backend_ssl }} # General, only applies to neutron server host group vlan_transparent = False +# Availability zone +{% if neutron_default_availability_zones %} +default_availability_zones = {{ neutron_default_availability_zones | join(',') }} +{% if neutron_default_availability_zones | length > 1 %} +router_scheduler_driver = neutron.scheduler.l3_agent_scheduler.AZLeastRoutersScheduler +network_scheduler_driver = neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler +{% endif %} +{% endif %} + # Plugins core_plugin = {{ neutron_plugin_core }} {% if neutron_plugin_type.split('.')[0] == 'ml2' %}