Update pool erases member config
When a LBaaSv1 pool is being updated, the update erases the pool config. Change-Id: Ib0fab216c5affa0c3075689c8e7dd8b1c9e18598 Fixes-Bug: #1527178
This commit is contained in:
parent
852da6f12d
commit
588f84bf7b
@ -62,26 +62,27 @@ def convert_lbaas_app_profile(name, sess_persist, protocol):
|
||||
if protocol == lb_const.LB_PROTOCOL_HTTPS:
|
||||
vcns_app_profile['sslPassthrough'] = True
|
||||
|
||||
persist_type = sess_persist.get('type')
|
||||
if persist_type:
|
||||
# If protocol is not HTTP, only source_ip is supported
|
||||
if (protocol != lb_const.LB_PROTOCOL_HTTP and
|
||||
persist_type != lb_const.LB_SESSION_PERSISTENCE_SOURCE_IP):
|
||||
msg = (_('Invalid %(protocol)s persistence method: %(type)s') %
|
||||
{'protocol': protocol,
|
||||
'type': persist_type})
|
||||
raise n_exc.BadRequest(resource='edge-lbaas', msg=msg)
|
||||
persistence = {
|
||||
'method':
|
||||
lb_const.SESSION_PERSISTENCE_METHOD_MAP.get(persist_type)}
|
||||
if persist_type in lb_const.SESSION_PERSISTENCE_COOKIE_MAP:
|
||||
persistence.update({
|
||||
'cookieName': sess_persist.get('cookie_name',
|
||||
'default_cookie_name'),
|
||||
'cookieMode':
|
||||
lb_const.SESSION_PERSISTENCE_COOKIE_MAP[persist_type]})
|
||||
if sess_persist:
|
||||
persist_type = sess_persist.get('type')
|
||||
if persist_type:
|
||||
# If protocol is not HTTP, only source_ip is supported
|
||||
if (protocol != lb_const.LB_PROTOCOL_HTTP and
|
||||
persist_type != lb_const.LB_SESSION_PERSISTENCE_SOURCE_IP):
|
||||
msg = (_('Invalid %(protocol)s persistence method: %(type)s') %
|
||||
{'protocol': protocol,
|
||||
'type': persist_type})
|
||||
raise n_exc.BadRequest(resource='edge-lbaas', msg=msg)
|
||||
persistence = {
|
||||
'method':
|
||||
lb_const.SESSION_PERSISTENCE_METHOD_MAP.get(persist_type)}
|
||||
if persist_type in lb_const.SESSION_PERSISTENCE_COOKIE_MAP:
|
||||
persistence.update({
|
||||
'cookieName': sess_persist.get('cookie_name',
|
||||
'default_cookie_name'),
|
||||
'cookieMode':
|
||||
lb_const.SESSION_PERSISTENCE_COOKIE_MAP[persist_type]})
|
||||
|
||||
vcns_app_profile['persistence'] = persistence
|
||||
vcns_app_profile['persistence'] = persistence
|
||||
return vcns_app_profile
|
||||
|
||||
|
||||
@ -206,9 +207,12 @@ class EdgeLbDriver(object):
|
||||
try:
|
||||
with locking.LockManager.get_lock(pool_mapping['edge_id'],
|
||||
external=True):
|
||||
curr_pool = self.vcns.get_pool(pool_mapping['edge_id'],
|
||||
pool_mapping['edge_pool_id'])[1]
|
||||
curr_pool.update(edge_pool)
|
||||
self.vcns.update_pool(pool_mapping['edge_id'],
|
||||
pool_mapping['edge_pool_id'],
|
||||
edge_pool)
|
||||
curr_pool)
|
||||
self.lbv1_driver.pool_successful(context, pool)
|
||||
|
||||
except nsxv_exc.VcnsApiException:
|
||||
|
@ -188,8 +188,10 @@ class TestEdgeLbDriver(base.BaseTestCase):
|
||||
|
||||
pool_mapping = {'edge_id': EDGE_ID, 'edge_pool_id': EDGE_POOL_ID}
|
||||
with self._mock_edge_lbv1_driver('pool_successful') as pool_successful,\
|
||||
self._mock_edge_driver_vcns('get_pool') as get_pool, \
|
||||
self._mock_edge_driver_vcns('update_pool') as update_pool:
|
||||
|
||||
get_pool.return_value = (None, {})
|
||||
self.edge_driver.update_pool(
|
||||
self.context, from_pool, to_pool, pool_mapping)
|
||||
update_pool.assert_called_with(EDGE_ID, EDGE_POOL_ID, edge_pool)
|
||||
|
Loading…
Reference in New Issue
Block a user