Allow 'max_l3_agents_per_router' to be set to '0'
Currently the field 'max_l3_agents_per_router' from
'neutron.conf' cannot be set to '0' even though the comments
and code indicate it is be supported. The value
means 'unlimited' agents per router is allowed on HA routers.
This issue is a regression that was caused by:
7da314434e
This patch adds a special handling for this value when validating
the config. When a value of '0' is used, the further validation
of max value is skipped.
Change-Id: Iac85768b350ee16c34893218738974a2692202aa
Closes-Bug: #1414548
This commit is contained in:
parent
f2f06faf89
commit
421b5cd43b
|
@ -32,6 +32,7 @@ from neutron.openstack.common import log as logging
|
|||
|
||||
VR_ID_RANGE = set(range(1, 255))
|
||||
MAX_ALLOCATION_TRIES = 10
|
||||
UNLIMITED_AGENTS_PER_ROUTER = 0
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -131,9 +132,14 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin):
|
|||
if ('/' not in self.ha_cidr or net.network != net.ip):
|
||||
raise l3_ha.HANetworkCIDRNotValid(cidr=self.ha_cidr)
|
||||
|
||||
self._check_num_agents_per_router()
|
||||
|
||||
def _check_num_agents_per_router(self):
|
||||
max_agents = cfg.CONF.max_l3_agents_per_router
|
||||
min_agents = cfg.CONF.min_l3_agents_per_router
|
||||
if max_agents < min_agents:
|
||||
|
||||
if (max_agents != UNLIMITED_AGENTS_PER_ROUTER
|
||||
and max_agents < min_agents):
|
||||
raise l3_ha.HAMaximumAgentsNumberNotValid(
|
||||
max_agents=max_agents, min_agents=min_agents)
|
||||
|
||||
|
|
|
@ -120,14 +120,19 @@ class L3HATestCase(L3HATestFramework):
|
|||
cfg.CONF.set_override('min_l3_agents_per_router', 0)
|
||||
self.assertRaises(
|
||||
l3_ext_ha_mode.HAMinimumAgentsNumberNotValid,
|
||||
self.plugin._verify_configuration)
|
||||
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)
|
||||
self.assertRaises(
|
||||
l3_ext_ha_mode.HAMaximumAgentsNumberNotValid,
|
||||
self.plugin._verify_configuration)
|
||||
self.plugin._check_num_agents_per_router)
|
||||
|
||||
def test_verify_configuration_max_l3_agents_unlimited(self):
|
||||
cfg.CONF.set_override('max_l3_agents_per_router',
|
||||
l3_hamode_db.UNLIMITED_AGENTS_PER_ROUTER)
|
||||
self.plugin._check_num_agents_per_router()
|
||||
|
||||
def test_ha_router_create(self):
|
||||
router = self._create_router()
|
||||
|
|
Loading…
Reference in New Issue