Enable support for l3agent- and dhcp-failover

Implements the missing configuration options and context to configure
allow-automatic-l3agent-failover and allow-automatic-dhcp-failover
options in neutron.conf. The options are respectively added to
versions juno and kilo upwards as those are the Neutron versions
since they were first supported.

Change-Id: I7e465b7fef13f61f7b37135a86ac2f590c0c9be6
Closes-Bug: #1799956
This commit is contained in:
Niels van Adrichem 2018-10-25 13:15:28 +00:00 committed by Dmitrii Shcherbakov
parent 1d069c78b4
commit 5f255bc9f9
11 changed files with 61 additions and 0 deletions

View File

@ -330,6 +330,29 @@ options:
description: |
Minimum number of l3 agents to host a router. Only used when enable-l3ha
is True.
allow-automatic-l3agent-failover:
type: boolean
default: False
description: |
Automatically reschedule routers from offline L3 agents to online L3
agents. Note that it is advised to set this to true even when
Distributed Virtual routing is enabled, since SNAT for nodes without
floating IPs is set up centrally on an L3 agent. For DVR the 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
namespaces.
allow-automatic-dhcp-failover:
type: boolean
default: True
description: |
Automatically remove networks from offline DHCP agents and reschedule
them to online DHCP agents. This option can be used in conjunction with
dhcp-agents-per-network as a single network can be maintained by multiple
dhcp agents. Practically, rescheduling involves creating a dhcp network
namespace and starting a DHCP agent like the default dnsmasq one in that
network namespace. If availability zone information is propagated to
neutron-openvswitch and neutron-gateway units from the underlying Juju
provider (e.g. MAAS), it may also affect rescheduling.
dhcp-agents-per-network:
type: int
default: 1

View File

@ -396,6 +396,10 @@ class NeutronCCContext(context.NeutronContext):
ctxt['max_l3_agents_per_router'] = max_agents
ctxt['min_l3_agents_per_router'] = min_agents
ctxt['allow_automatic_l3agent_failover'] = \
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

View File

@ -1,3 +1,4 @@
# juno
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
@ -23,6 +24,8 @@ 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 }}
{% if neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}
{% else -%}

View File

@ -23,6 +23,9 @@ 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 neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}
{% else -%}

View File

@ -24,6 +24,9 @@ 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 neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}
{% else -%}

View File

@ -26,6 +26,9 @@ 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 neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}
{% else -%}

View File

@ -26,6 +26,9 @@ 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 neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}
{% else -%}

View File

@ -26,6 +26,9 @@ 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 neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}
{% else -%}

View File

@ -26,6 +26,9 @@ 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 neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}
{% else -%}

View File

@ -26,6 +26,9 @@ 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 neutron_bind_port -%}
bind_port = {{ neutron_bind_port }}
{% else -%}

View File

@ -416,6 +416,8 @@ class NeutronCCContextTest(CharmTestCase):
'debug': True,
'enable_dvr': False,
'l3_ha': False,
'allow_automatic_dhcp_failover': True,
'allow_automatic_l3agent_failover': False,
'mechanism_drivers': 'openvswitch,l2population',
'dhcp_agents_per_network': 3,
'enable_sriov': False,
@ -462,6 +464,8 @@ class NeutronCCContextTest(CharmTestCase):
'debug': True,
'enable_dvr': False,
'l3_ha': False,
'allow_automatic_dhcp_failover': True,
'allow_automatic_l3agent_failover': False,
'mechanism_drivers': 'openvswitch,hyperv,l2population',
'dhcp_agents_per_network': 3,
'enable_sriov': False,
@ -555,6 +559,8 @@ class NeutronCCContextTest(CharmTestCase):
'debug': True,
'enable_dvr': False,
'l3_ha': False,
'allow_automatic_dhcp_failover': True,
'allow_automatic_l3agent_failover': False,
'mechanism_drivers': 'openvswitch,l2population',
'dhcp_agents_per_network': 3,
'enable_sriov': False,
@ -618,6 +624,8 @@ class NeutronCCContextTest(CharmTestCase):
'tenant_network_types': 'gre,vlan,flat,local',
'max_l3_agents_per_router': 2,
'min_l3_agents_per_router': 2,
'allow_automatic_dhcp_failover': True,
'allow_automatic_l3agent_failover': False,
'dhcp_agents_per_network': 3,
'enable_sriov': False,
'quota_floatingip': 50,
@ -672,6 +680,8 @@ class NeutronCCContextTest(CharmTestCase):
'debug': True,
'enable_dvr': False,
'l3_ha': False,
'allow_automatic_dhcp_failover': True,
'allow_automatic_l3agent_failover': False,
'mechanism_drivers': 'openvswitch,hyperv,l2population'
',sriovnicswitch',
'dhcp_agents_per_network': 3,