Use AZLeastRoutersScheduler by default

Neutron uses an AZ-unaware scheduler (LeastRoutersScheduler) by default
in its configuration and the neutron-api charm does not override it.

AZLeastRoutersScheduler inherits from LeastRoutersScheduler and does the
same, plus respects AZ hints when scheduling HA routers.

For --distributed --ha routers using AZLeastRoutersScheduler means that
snat namespaces will be scheduled with respect to the AZ hints specified
during router creation by an operator.

For --ha but not distributed routers using AZLeastRoutersScheduler means
that qrouter namespaces will be scheduled with respect to the AZ hints.

snat namespaces (--ha & --distributed) and qrouter namespaces (--ha
only) are placed by the scheduler to l3 agents that run in the dvr_snat
mode only so the scheduler change will affect both the deployments with
neutron-gateway units and the ones with neutron-openvswitch running with
use-dvr-snat=True.

Change-Id: I98cd67ff0cf5418a9699acc7aff96c3edb9b2341
Closes-Bug: #1886195
This commit is contained in:
Dmitrii Shcherbakov 2020-10-28 13:31:30 +03:00
parent a32af1b98b
commit a155e9cf11
11 changed files with 36 additions and 0 deletions

View File

@ -376,6 +376,12 @@ options:
namespace will be rescheduled only to L3 agents running in the 'dvr_snat' namespace will be rescheduled only to L3 agents running in the 'dvr_snat'
mode, while l3 agents in the 'dvr' mode will only host qrouter and fip mode, while l3 agents in the 'dvr' mode will only host qrouter and fip
namespaces. namespaces.
router-scheduler-driver:
type: string
default: 'neutron.scheduler.l3_agent_scheduler.AZLeastRoutersScheduler'
description: |
The driver to use for router scheduling. In case of distributed routers
this will affect snat namespace scheduling.
allow-automatic-dhcp-failover: allow-automatic-dhcp-failover:
type: boolean type: boolean
default: True default: True

View File

@ -522,6 +522,9 @@ class NeutronCCContext(context.NeutronContext):
'neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler' 'neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler'
) )
ctxt['dhcp_load_type'] = config('dhcp-load-type') ctxt['dhcp_load_type'] = config('dhcp-load-type')
# AZLeastRoutersScheduler inherits from LeastRoutersScheduler and
# is available as of mitaka.
ctxt['router_scheduler_driver'] = config('router-scheduler-driver')
extension_drivers = [] extension_drivers = []
if config('enable-ml2-port-security'): if config('enable-ml2-port-security'):

View File

@ -32,6 +32,9 @@ allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
network_scheduler_driver = {{ network_scheduler_driver }} network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }} dhcp_load_type = {{ dhcp_load_type }}
{% endif -%} {% endif -%}
{% if router_scheduler_driver -%}
router_scheduler_driver = {{ router_scheduler_driver }}
{% endif -%}
{% if neutron_bind_port -%} {% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }} bind_port = {{ neutron_bind_port }}

View File

@ -32,6 +32,9 @@ allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
network_scheduler_driver = {{ network_scheduler_driver }} network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }} dhcp_load_type = {{ dhcp_load_type }}
{% endif -%} {% endif -%}
{% if router_scheduler_driver -%}
router_scheduler_driver = {{ router_scheduler_driver }}
{% endif -%}
{% if neutron_bind_port -%} {% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }} bind_port = {{ neutron_bind_port }}

View File

@ -35,6 +35,9 @@ allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
network_scheduler_driver = {{ network_scheduler_driver }} network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }} dhcp_load_type = {{ dhcp_load_type }}
{% endif -%} {% endif -%}
{% if router_scheduler_driver -%}
router_scheduler_driver = {{ router_scheduler_driver }}
{% endif -%}
{% if neutron_bind_port -%} {% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }} bind_port = {{ neutron_bind_port }}

View File

@ -35,6 +35,9 @@ allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
network_scheduler_driver = {{ network_scheduler_driver }} network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }} dhcp_load_type = {{ dhcp_load_type }}
{% endif -%} {% endif -%}
{% if router_scheduler_driver -%}
router_scheduler_driver = {{ router_scheduler_driver }}
{% endif -%}
{% if neutron_bind_port -%} {% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }} bind_port = {{ neutron_bind_port }}

View File

@ -35,6 +35,9 @@ allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
network_scheduler_driver = {{ network_scheduler_driver }} network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }} dhcp_load_type = {{ dhcp_load_type }}
{% endif -%} {% endif -%}
{% if router_scheduler_driver -%}
router_scheduler_driver = {{ router_scheduler_driver }}
{% endif -%}
{% if neutron_bind_port -%} {% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }} bind_port = {{ neutron_bind_port }}

View File

@ -35,6 +35,9 @@ allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
network_scheduler_driver = {{ network_scheduler_driver }} network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }} dhcp_load_type = {{ dhcp_load_type }}
{% endif -%} {% endif -%}
{% if router_scheduler_driver -%}
router_scheduler_driver = {{ router_scheduler_driver }}
{% endif -%}
{% if neutron_bind_port -%} {% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }} bind_port = {{ neutron_bind_port }}

View File

@ -35,6 +35,9 @@ allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
network_scheduler_driver = {{ network_scheduler_driver }} network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }} dhcp_load_type = {{ dhcp_load_type }}
{% endif -%} {% endif -%}
{% if router_scheduler_driver -%}
router_scheduler_driver = {{ router_scheduler_driver }}
{% endif -%}
{% if neutron_bind_port -%} {% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }} bind_port = {{ neutron_bind_port }}

View File

@ -35,6 +35,9 @@ allow_automatic_dhcp_failover = {{ allow_automatic_dhcp_failover }}
network_scheduler_driver = {{ network_scheduler_driver }} network_scheduler_driver = {{ network_scheduler_driver }}
dhcp_load_type = {{ dhcp_load_type }} dhcp_load_type = {{ dhcp_load_type }}
{% endif -%} {% endif -%}
{% if router_scheduler_driver -%}
router_scheduler_driver = {{ router_scheduler_driver }}
{% endif -%}
{% if neutron_bind_port -%} {% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }} bind_port = {{ neutron_bind_port }}

View File

@ -527,6 +527,9 @@ class NeutronCCContextTest(CharmTestCase):
'neutron.scheduler.dhcp_agent_scheduler' 'neutron.scheduler.dhcp_agent_scheduler'
'.AZAwareWeightScheduler'), '.AZAwareWeightScheduler'),
'dhcp_load_type': 'networks', 'dhcp_load_type': 'networks',
'router_scheduler_driver': (
'neutron.scheduler.l3_agent_scheduler'
'.AZLeastRoutersScheduler'),
} }
napi_ctxt = context.NeutronCCContext() napi_ctxt = context.NeutronCCContext()
self.maxDiff = None self.maxDiff = None