Merge "Allow min_l3_agents_per_router to equal one" into stable/mitaka

This commit is contained in:
Jenkins 2016-07-12 06:03:51 +00:00 committed by Gerrit Code Review
commit 8cf124ac40
4 changed files with 12 additions and 8 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

@ -61,10 +61,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=constants.MINIMUM_AGENTS_FOR_HA,
help=_("Minimum number of L3 agents which a HA router will be "
"scheduled on. If it is set to 0 then the router will "
"be scheduled on every agent.")),
default=constants.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='169.254.192.0/18',
help=_('Subnet used for the l3 HA admin network.')),
@ -178,7 +177,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 < constants.MINIMUM_AGENTS_FOR_HA:
if min_agents < constants.MINIMUM_MINIMUM_AGENTS_FOR_HA:
raise l3_ha.HAMinimumAgentsNumberNotValid()
def __init__(self):

View File

@ -88,8 +88,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.") %
constants.MINIMUM_AGENTS_FOR_HA)
"It has to be greater than or equal to %s for HA.") %
constants.MINIMUM_MINIMUM_AGENTS_FOR_HA)
class L3_ext_ha_mode(extensions.ExtensionDescriptor):

View File

@ -122,6 +122,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)