Switch to AZAwareWeightScheduler as of Mitaka

AZAwareWeightScheduler is based on WeightScheduler and provides a way to make
DHCP agent scheduling be AZ-aware. This is used in conjunction with
dhcp-agents-per-network config option and per-network agents (such as dnsmasq)
will be distributed across neutron-dhcp-agents that have availability_zone
configuration (based on dhcp-load-type for placement calculation).

bp: https://blueprints.launchpad.net/neutron/+spec/add-availability-zone

Upgrade impact is mentioned here:
specs.openstack.org/openstack/neutron-specs/specs/mitaka/availability-zone.html

The spec mentions that by default all agents belong to 'nova' AZ so
the scheduler change should be backwards-compatible.

Change-Id: I4d948efa157573fdbc0fbfd3b1efb21b69a713ef
Closes-Bug: #1796068
This commit is contained in:
Dmitrii Shcherbakov 2019-01-21 14:39:41 +02:00
parent e61644060f
commit 1e6430f9c6
9 changed files with 45 additions and 0 deletions

View File

@ -726,3 +726,9 @@ options:
The size in bits of the prefix for the IPv6 reverse lookup (PTR) zones.
.
NOTE: Use only when "reverse-dns-lookup" option is set to "True".
dhcp-load-type:
type: string
default: 'networks'
description: |
Sets the resource type used in weight calculations during
AZ-aware scheduling (networks, subnets or ports).

View File

@ -400,6 +400,7 @@ class NeutronCCContext(context.NeutronContext):
config('allow-automatic-l3agent-failover')
ctxt['allow_automatic_dhcp_failover'] = \
config('allow-automatic-dhcp-failover')
ctxt['dhcp_agents_per_network'] = config('dhcp-agents-per-network')
ctxt['tenant_network_types'] = self.neutron_tenant_network_types
ctxt['overlay_network_type'] = self.neutron_overlay_network_type
@ -472,6 +473,13 @@ class NeutronCCContext(context.NeutronContext):
if related_units(rid):
enable_dns_extension_driver = True
# AZAwareWeightScheduler inherits from WeightScheduler and is
# available as of mitaka
ctxt['network_scheduler_driver'] = (
'neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler'
)
ctxt['dhcp_load_type'] = config('dhcp-load-type')
extension_drivers = []
if config('enable-ml2-port-security'):
extension_drivers.append(EXTENSION_DRIVER_PORT_SECURITY)

View File

@ -28,6 +28,10 @@ min_l3_agents_per_router = {{ min_l3_agents_per_router }}
allow_automatic_l3agent_failover = {{ allow_automatic_l3agent_failover }}
allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
{% if network_scheduler_driver -%}
network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }}
{% endif -%}
{% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}

View File

@ -28,6 +28,10 @@ min_l3_agents_per_router = {{ min_l3_agents_per_router }}
allow_automatic_l3agent_failover = {{ allow_automatic_l3agent_failover }}
allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
{% if network_scheduler_driver -%}
network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }}
{% endif -%}
{% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}

View File

@ -28,6 +28,10 @@ min_l3_agents_per_router = {{ min_l3_agents_per_router }}
allow_automatic_l3agent_failover = {{ allow_automatic_l3agent_failover }}
allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
{% if network_scheduler_driver -%}
network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }}
{% endif -%}
{% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}

View File

@ -28,6 +28,10 @@ min_l3_agents_per_router = {{ min_l3_agents_per_router }}
allow_automatic_l3agent_failover = {{ allow_automatic_l3agent_failover }}
allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
{% if network_scheduler_driver -%}
network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }}
{% endif -%}
{% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}

View File

@ -28,6 +28,10 @@ min_l3_agents_per_router = {{ min_l3_agents_per_router }}
allow_automatic_l3agent_failover = {{ allow_automatic_l3agent_failover }}
allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
{% if network_scheduler_driver -%}
network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }}
{% endif -%}
{% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}

View File

@ -26,6 +26,13 @@ max_l3_agents_per_router = {{ max_l3_agents_per_router }}
min_l3_agents_per_router = {{ min_l3_agents_per_router }}
{% endif -%}
allow_automatic_l3agent_failover = {{ allow_automatic_l3agent_failover }}
allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
{% if network_scheduler_driver -%}
network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }}
{% endif -%}
{% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}
{% else -%}

View File

@ -492,6 +492,10 @@ class NeutronCCContextTest(CharmTestCase):
'vni_ranges': '1001:2000',
'extension_drivers': 'port_security',
'service_plugins': 'router,firewall,lbaas,vpnaas,metering',
'network_scheduler_driver': (
'neutron.scheduler.dhcp_agent_scheduler'
'.AZAwareWeightScheduler'),
'dhcp_load_type': 'networks',
}
napi_ctxt = context.NeutronCCContext()
self.maxDiff = None