Merge "Add config option for pool algorithms"

This commit is contained in:
Zuul 2019-04-22 15:37:14 +00:00 committed by Gerrit Code Review
commit be3dfc8a76
2 changed files with 21 additions and 12 deletions

View File

@ -167,18 +167,22 @@ lb_feature_enabled_group = cfg.OptGroup(name='loadbalancer-feature-enabled',
LBFeatureEnabledGroup = [
cfg.BoolOpt('health_monitor_enabled',
default=True,
help="Whether Health Monitor is available with provider"
" driver or not."),
help="Whether Health Monitor is available with provider "
"driver or not."),
cfg.BoolOpt('terminated_tls_enabled',
default=True,
help="Whether TLS termination is available with provider "
"driver or not."),
cfg.BoolOpt('l7_protocol_enabled',
default=True,
help="Whether L7 Protocols are available with the provider"
" driver or not."),
help="Whether L7 Protocols are available with the provider "
"driver or not."),
cfg.BoolOpt('pool_algorithms_enabled',
default=True,
help="Whether pool algorithms are available with provider"
"driver or not."),
cfg.StrOpt('l4_protocol',
default="TCP",
help="The type of L4 Protocol which is supported with the"
" provider driver."),
help="The type of L4 Protocol which is supported with the "
"provider driver."),
]

View File

@ -51,9 +51,9 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
CONF.load_balancer.lb_build_interval,
CONF.load_balancer.lb_build_timeout)
cls.protocol = const.HTTP
lb_feature_enabled = CONF.loadbalancer_feature_enabled
if not lb_feature_enabled.l7_protocol_enabled:
cls.protocol = lb_feature_enabled.l4_protocol
cls.lb_feature_enabled = CONF.loadbalancer_feature_enabled
if not cls.lb_feature_enabled.l7_protocol_enabled:
cls.protocol = cls.lb_feature_enabled.l4_protocol
listener_name = data_utils.rand_name("lb_member_listener1_pool")
listener_kwargs = {
@ -161,8 +161,12 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
const.NAME: new_name,
const.DESCRIPTION: new_description,
const.ADMIN_STATE_UP: True,
const.LB_ALGORITHM: const.LB_ALGORITHM_LEAST_CONNECTIONS,
}
if self.lb_feature_enabled.pool_algorithms_enabled:
pool_update_kwargs[const.LB_ALGORITHM] = \
const.LB_ALGORITHM_LEAST_CONNECTIONS
if self.protocol == const.HTTP:
pool_update_kwargs[const.SESSION_PERSISTENCE] = {
const.TYPE: const.SESSION_PERSISTENCE_HTTP_COOKIE}
@ -184,8 +188,9 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
self.assertEqual(new_name, pool[const.NAME])
self.assertEqual(new_description, pool[const.DESCRIPTION])
self.assertTrue(pool[const.ADMIN_STATE_UP])
self.assertEqual(const.LB_ALGORITHM_LEAST_CONNECTIONS,
pool[const.LB_ALGORITHM])
if self.lb_feature_enabled.pool_algorithms_enabled:
self.assertEqual(const.LB_ALGORITHM_LEAST_CONNECTIONS,
pool[const.LB_ALGORITHM])
self.assertIsNotNone(pool.get(const.SESSION_PERSISTENCE))
if self.protocol == const.HTTP:
self.assertEqual(const.SESSION_PERSISTENCE_HTTP_COOKIE,