Allow min_l3_agents_per_router to equal one

As an operator, when I am running a setup with two network nodes, the
idea of running L3 HA is that an outage of one of the network nodes
should have minimum customer impact. With the current rules in place,
existing setups will indeed have little to no impact, but customers will
not be able to create new routers during the outage.

With this chance in place, we can set min_l3_agents_per_router=1, so the
customers will be affected even less. New routers will be created with
just one instance, which certainly is not optimal, but at least will
fulfill the customer request. Once the second network node recovers, the
second router instance will be added and thus redundancy restored.

Also change the help text to specify the effect of setting
min_l3_agents_per_router more clearly.

Closes-Bug: 1555042
Change-Id: I8a5fc74a96c784d474aefe2d9b27eeb66521ca82
This commit is contained in:
Jens Rosenboom 2016-03-08 14:31:34 +01:00
parent f602918205
commit ab131ee0af
4 changed files with 12 additions and 7 deletions

View File

@ -43,7 +43,8 @@ SNAT_ROUTER_INTF_KEY = '_snat_router_interfaces'
HA_NETWORK_NAME = 'HA network tenant %s'
HA_SUBNET_NAME = 'HA subnet tenant %s'
HA_PORT_NAME = 'HA port tenant %s'
MINIMUM_AGENTS_FOR_HA = 2
MINIMUM_MINIMUM_AGENTS_FOR_HA = 1
DEFAULT_MINIMUM_AGENTS_FOR_HA = 2
HA_ROUTER_STATE_ACTIVE = 'active'
HA_ROUTER_STATE_STANDBY = 'standby'

View File

@ -62,9 +62,9 @@ L3_HA_OPTS = [
"scheduled on. If it is set to 0 then the router will "
"be scheduled on every agent.")),
cfg.IntOpt('min_l3_agents_per_router',
default=n_const.MINIMUM_AGENTS_FOR_HA,
help=_("Minimum number of L3 agents which a HA router will be "
"scheduled on.")),
default=n_const.DEFAULT_MINIMUM_AGENTS_FOR_HA,
help=_("Minimum number of L3 agents that have to be available "
"in order to allow a new HA router to be scheduled.")),
cfg.StrOpt('l3_ha_net_cidr',
default=n_const.L3_HA_NET_CIDR,
help=_('Subnet used for the l3 HA admin network.')),
@ -178,7 +178,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
raise l3_ha.HAMaximumAgentsNumberNotValid(
max_agents=max_agents, min_agents=min_agents)
if min_agents < n_const.MINIMUM_AGENTS_FOR_HA:
if min_agents < n_const.MINIMUM_MINIMUM_AGENTS_FOR_HA:
raise l3_ha.HAMinimumAgentsNumberNotValid()
def __init__(self):

View File

@ -89,8 +89,8 @@ class HAMaximumAgentsNumberNotValid(exceptions.NeutronException):
class HAMinimumAgentsNumberNotValid(exceptions.NeutronException):
message = (_("min_l3_agents_per_router config parameter is not valid. "
"It has to be equal to or more than %s for HA.") %
n_const.MINIMUM_AGENTS_FOR_HA)
"It has to be greater than or equal to %s for HA.") %
n_const.MINIMUM_MINIMUM_AGENTS_FOR_HA)
class L3_ext_ha_mode(extensions.ExtensionDescriptor):

View File

@ -121,6 +121,10 @@ class L3HATestCase(L3HATestFramework):
l3_ext_ha_mode.HAMinimumAgentsNumberNotValid,
self.plugin._check_num_agents_per_router)
def test_verify_configuration_min_l3_agents_per_router_eq_one(self):
cfg.CONF.set_override('min_l3_agents_per_router', 1)
self.plugin._check_num_agents_per_router()
def test_verify_configuration_max_l3_agents_below_min_l3_agents(self):
cfg.CONF.set_override('max_l3_agents_per_router', 3)
cfg.CONF.set_override('min_l3_agents_per_router', 4)