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:
|
if protocol == lb_const.LB_PROTOCOL_HTTPS:
|
||||||
vcns_app_profile['sslPassthrough'] = True
|
vcns_app_profile['sslPassthrough'] = True
|
||||||
|
|
||||||
persist_type = sess_persist.get('type')
|
if sess_persist:
|
||||||
if persist_type:
|
persist_type = sess_persist.get('type')
|
||||||
# If protocol is not HTTP, only source_ip is supported
|
if persist_type:
|
||||||
if (protocol != lb_const.LB_PROTOCOL_HTTP and
|
# If protocol is not HTTP, only source_ip is supported
|
||||||
persist_type != lb_const.LB_SESSION_PERSISTENCE_SOURCE_IP):
|
if (protocol != lb_const.LB_PROTOCOL_HTTP and
|
||||||
msg = (_('Invalid %(protocol)s persistence method: %(type)s') %
|
persist_type != lb_const.LB_SESSION_PERSISTENCE_SOURCE_IP):
|
||||||
{'protocol': protocol,
|
msg = (_('Invalid %(protocol)s persistence method: %(type)s') %
|
||||||
'type': persist_type})
|
{'protocol': protocol,
|
||||||
raise n_exc.BadRequest(resource='edge-lbaas', msg=msg)
|
'type': persist_type})
|
||||||
persistence = {
|
raise n_exc.BadRequest(resource='edge-lbaas', msg=msg)
|
||||||
'method':
|
persistence = {
|
||||||
lb_const.SESSION_PERSISTENCE_METHOD_MAP.get(persist_type)}
|
'method':
|
||||||
if persist_type in lb_const.SESSION_PERSISTENCE_COOKIE_MAP:
|
lb_const.SESSION_PERSISTENCE_METHOD_MAP.get(persist_type)}
|
||||||
persistence.update({
|
if persist_type in lb_const.SESSION_PERSISTENCE_COOKIE_MAP:
|
||||||
'cookieName': sess_persist.get('cookie_name',
|
persistence.update({
|
||||||
'default_cookie_name'),
|
'cookieName': sess_persist.get('cookie_name',
|
||||||
'cookieMode':
|
'default_cookie_name'),
|
||||||
lb_const.SESSION_PERSISTENCE_COOKIE_MAP[persist_type]})
|
'cookieMode':
|
||||||
|
lb_const.SESSION_PERSISTENCE_COOKIE_MAP[persist_type]})
|
||||||
|
|
||||||
vcns_app_profile['persistence'] = persistence
|
vcns_app_profile['persistence'] = persistence
|
||||||
return vcns_app_profile
|
return vcns_app_profile
|
||||||
|
|
||||||
|
|
||||||
@ -206,9 +207,12 @@ class EdgeLbDriver(object):
|
|||||||
try:
|
try:
|
||||||
with locking.LockManager.get_lock(pool_mapping['edge_id'],
|
with locking.LockManager.get_lock(pool_mapping['edge_id'],
|
||||||
external=True):
|
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'],
|
self.vcns.update_pool(pool_mapping['edge_id'],
|
||||||
pool_mapping['edge_pool_id'],
|
pool_mapping['edge_pool_id'],
|
||||||
edge_pool)
|
curr_pool)
|
||||||
self.lbv1_driver.pool_successful(context, pool)
|
self.lbv1_driver.pool_successful(context, pool)
|
||||||
|
|
||||||
except nsxv_exc.VcnsApiException:
|
except nsxv_exc.VcnsApiException:
|
||||||
|
@ -188,8 +188,10 @@ class TestEdgeLbDriver(base.BaseTestCase):
|
|||||||
|
|
||||||
pool_mapping = {'edge_id': EDGE_ID, 'edge_pool_id': EDGE_POOL_ID}
|
pool_mapping = {'edge_id': EDGE_ID, 'edge_pool_id': EDGE_POOL_ID}
|
||||||
with self._mock_edge_lbv1_driver('pool_successful') as pool_successful,\
|
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:
|
self._mock_edge_driver_vcns('update_pool') as update_pool:
|
||||||
|
|
||||||
|
get_pool.return_value = (None, {})
|
||||||
self.edge_driver.update_pool(
|
self.edge_driver.update_pool(
|
||||||
self.context, from_pool, to_pool, pool_mapping)
|
self.context, from_pool, to_pool, pool_mapping)
|
||||||
update_pool.assert_called_with(EDGE_ID, EDGE_POOL_ID, edge_pool)
|
update_pool.assert_called_with(EDGE_ID, EDGE_POOL_ID, edge_pool)
|
||||||
|
Loading…
Reference in New Issue
Block a user