Fix pools going into ERROR when updating the pool

There was a bug that would cause a pool to go into ERROR if you attempted
to update the CRL or client certificate on the pool.

Change-Id: I736816247131715f5c385b4680614ec3218a2ad7
Story: 2008295
Task: 41180
This commit is contained in:
Michael Johnson 2020-10-29 14:52:32 -07:00 committed by Gregory Thiemonge
parent a822f30eb1
commit 370aa4e61c
5 changed files with 41 additions and 14 deletions

View File

@ -214,16 +214,16 @@ class AmphoraProviderDriver(driver_base.ProviderDriver):
pool_dict['enabled'] = pool_dict.pop('admin_state_up') pool_dict['enabled'] = pool_dict.pop('admin_state_up')
pool_id = pool_dict.pop('pool_id') pool_id = pool_dict.pop('pool_id')
if 'tls_container_ref' in pool_dict: if 'tls_container_ref' in pool_dict:
pool_dict['tls_container_id'] = pool_dict.pop('tls_container_ref') pool_dict['tls_certificate_id'] = pool_dict.pop(
'tls_container_ref')
pool_dict.pop('tls_container_data', None) pool_dict.pop('tls_container_data', None)
if 'ca_tls_container_ref' in pool_dict: if 'ca_tls_container_ref' in pool_dict:
pool_dict['ca_tls_certificate_id'] = pool_dict.pop( pool_dict['ca_tls_certificate_id'] = pool_dict.pop(
'ca_tls_container_ref') 'ca_tls_container_ref')
pool_dict.pop('ca_tls_container_data', None) pool_dict.pop('ca_tls_container_data', None)
if 'client_crl_container_ref' in pool_dict: if 'crl_container_ref' in pool_dict:
pool_dict['client_crl_container_id'] = pool_dict.pop( pool_dict['crl_container_id'] = pool_dict.pop('crl_container_ref')
'client_crl_container_ref') pool_dict.pop('crl_container_data', None)
pool_dict.pop('client_crl_container_data', None)
payload = {consts.POOL_ID: pool_id, payload = {consts.POOL_ID: pool_id,
consts.POOL_UPDATES: pool_dict} consts.POOL_UPDATES: pool_dict}

View File

@ -222,16 +222,16 @@ class AmphoraProviderDriver(driver_base.ProviderDriver):
if 'admin_state_up' in pool_dict: if 'admin_state_up' in pool_dict:
pool_dict['enabled'] = pool_dict.pop('admin_state_up') pool_dict['enabled'] = pool_dict.pop('admin_state_up')
if 'tls_container_ref' in pool_dict: if 'tls_container_ref' in pool_dict:
pool_dict['tls_container_id'] = pool_dict.pop('tls_container_ref') pool_dict['tls_certificate_id'] = pool_dict.pop(
'tls_container_ref')
pool_dict.pop('tls_container_data', None) pool_dict.pop('tls_container_data', None)
if 'ca_tls_container_ref' in pool_dict: if 'ca_tls_container_ref' in pool_dict:
pool_dict['ca_tls_certificate_id'] = pool_dict.pop( pool_dict['ca_tls_certificate_id'] = pool_dict.pop(
'ca_tls_container_ref') 'ca_tls_container_ref')
pool_dict.pop('ca_tls_container_data', None) pool_dict.pop('ca_tls_container_data', None)
if 'client_crl_container_ref' in pool_dict: if 'crl_container_ref' in pool_dict:
pool_dict['client_crl_container_id'] = pool_dict.pop( pool_dict['crl_container_id'] = pool_dict.pop('crl_container_ref')
'client_crl_container_ref') pool_dict.pop('crl_container_data', None)
pool_dict.pop('client_crl_container_data', None)
return pool_dict return pool_dict
def pool_create(self, pool): def pool_create(self, pool):

View File

@ -259,8 +259,19 @@ class TestAmphoraDriver(base.TestRpc):
old_provider_pool = driver_dm.Pool( old_provider_pool = driver_dm.Pool(
pool_id=self.sample_data.pool1_id) pool_id=self.sample_data.pool1_id)
provider_pool = driver_dm.Pool( provider_pool = driver_dm.Pool(
pool_id=self.sample_data.pool1_id, admin_state_up=True) pool_id=self.sample_data.pool1_id, admin_state_up=True,
pool_dict = {'enabled': True} ca_tls_container_data='CA DATA', ca_tls_container_ref='CA REF',
crl_container_data='CRL DATA', crl_container_ref='CRL REF',
description='TEST DESCRIPTION', name='TEST NAME',
lb_algorithm=consts.LB_ALGORITHM_SOURCE_IP,
session_persistence='FAKE SP', tls_container_data='TLS DATA',
tls_container_ref='TLS REF', tls_enabled=False)
pool_dict = {'description': 'TEST DESCRIPTION',
'lb_algorithm': 'SOURCE_IP', 'name': 'TEST NAME',
'session_persistence': 'FAKE SP', 'tls_enabled': False,
'enabled': True, 'tls_certificate_id': 'TLS REF',
'ca_tls_certificate_id': 'CA REF',
'crl_container_id': 'CRL REF'}
self.amp_driver.pool_update(old_provider_pool, provider_pool) self.amp_driver.pool_update(old_provider_pool, provider_pool)
payload = {consts.POOL_ID: self.sample_data.pool1_id, payload = {consts.POOL_ID: self.sample_data.pool1_id,
consts.POOL_UPDATES: pool_dict} consts.POOL_UPDATES: pool_dict}

View File

@ -261,8 +261,19 @@ class TestAmphoraDriver(base.TestRpc):
old_provider_pool = driver_dm.Pool( old_provider_pool = driver_dm.Pool(
pool_id=self.sample_data.pool1_id) pool_id=self.sample_data.pool1_id)
provider_pool = driver_dm.Pool( provider_pool = driver_dm.Pool(
pool_id=self.sample_data.pool1_id, admin_state_up=True) pool_id=self.sample_data.pool1_id, admin_state_up=True,
pool_dict = {'enabled': True} ca_tls_container_data='CA DATA', ca_tls_container_ref='CA REF',
crl_container_data='CRL DATA', crl_container_ref='CRL REF',
description='TEST DESCRIPTION', name='TEST NAME',
lb_algorithm=consts.LB_ALGORITHM_SOURCE_IP,
session_persistence='FAKE SP', tls_container_data='TLS DATA',
tls_container_ref='TLS REF', tls_enabled=False)
pool_dict = {'description': 'TEST DESCRIPTION',
'lb_algorithm': 'SOURCE_IP', 'name': 'TEST NAME',
'session_persistence': 'FAKE SP', 'tls_enabled': False,
'enabled': True, 'tls_certificate_id': 'TLS REF',
'ca_tls_certificate_id': 'CA REF',
'crl_container_id': 'CRL REF'}
self.amp_driver.pool_update(old_provider_pool, provider_pool) self.amp_driver.pool_update(old_provider_pool, provider_pool)
payload = {consts.ORIGINAL_POOL: old_provider_pool.to_dict(), payload = {consts.ORIGINAL_POOL: old_provider_pool.to_dict(),
consts.POOL_UPDATES: pool_dict} consts.POOL_UPDATES: pool_dict}

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixed an issue were updating a CRL or client certificate on a pool would
cause the pool to go into ERROR.