From 370aa4e61c421311b06d986aafdf123cd6737fd8 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Thu, 29 Oct 2020 14:52:32 -0700 Subject: [PATCH] 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 --- octavia/api/drivers/amphora_driver/v1/driver.py | 10 +++++----- octavia/api/drivers/amphora_driver/v2/driver.py | 10 +++++----- .../api/drivers/amphora_driver/v1/test_driver.py | 15 +++++++++++++-- .../api/drivers/amphora_driver/v2/test_driver.py | 15 +++++++++++++-- .../notes/fix-pool-crl-2cc6f2705f5b2009.yaml | 5 +++++ 5 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 releasenotes/notes/fix-pool-crl-2cc6f2705f5b2009.yaml diff --git a/octavia/api/drivers/amphora_driver/v1/driver.py b/octavia/api/drivers/amphora_driver/v1/driver.py index 98a8de68ca..69290ba94c 100644 --- a/octavia/api/drivers/amphora_driver/v1/driver.py +++ b/octavia/api/drivers/amphora_driver/v1/driver.py @@ -214,16 +214,16 @@ class AmphoraProviderDriver(driver_base.ProviderDriver): pool_dict['enabled'] = pool_dict.pop('admin_state_up') pool_id = pool_dict.pop('pool_id') 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) if 'ca_tls_container_ref' in pool_dict: pool_dict['ca_tls_certificate_id'] = pool_dict.pop( 'ca_tls_container_ref') pool_dict.pop('ca_tls_container_data', None) - if 'client_crl_container_ref' in pool_dict: - pool_dict['client_crl_container_id'] = pool_dict.pop( - 'client_crl_container_ref') - pool_dict.pop('client_crl_container_data', None) + if 'crl_container_ref' in pool_dict: + pool_dict['crl_container_id'] = pool_dict.pop('crl_container_ref') + pool_dict.pop('crl_container_data', None) payload = {consts.POOL_ID: pool_id, consts.POOL_UPDATES: pool_dict} diff --git a/octavia/api/drivers/amphora_driver/v2/driver.py b/octavia/api/drivers/amphora_driver/v2/driver.py index 124acbebfc..c631625adb 100644 --- a/octavia/api/drivers/amphora_driver/v2/driver.py +++ b/octavia/api/drivers/amphora_driver/v2/driver.py @@ -222,16 +222,16 @@ class AmphoraProviderDriver(driver_base.ProviderDriver): if 'admin_state_up' in pool_dict: pool_dict['enabled'] = pool_dict.pop('admin_state_up') 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) if 'ca_tls_container_ref' in pool_dict: pool_dict['ca_tls_certificate_id'] = pool_dict.pop( 'ca_tls_container_ref') pool_dict.pop('ca_tls_container_data', None) - if 'client_crl_container_ref' in pool_dict: - pool_dict['client_crl_container_id'] = pool_dict.pop( - 'client_crl_container_ref') - pool_dict.pop('client_crl_container_data', None) + if 'crl_container_ref' in pool_dict: + pool_dict['crl_container_id'] = pool_dict.pop('crl_container_ref') + pool_dict.pop('crl_container_data', None) return pool_dict def pool_create(self, pool): diff --git a/octavia/tests/unit/api/drivers/amphora_driver/v1/test_driver.py b/octavia/tests/unit/api/drivers/amphora_driver/v1/test_driver.py index b22f4a44d1..a3ffa62040 100644 --- a/octavia/tests/unit/api/drivers/amphora_driver/v1/test_driver.py +++ b/octavia/tests/unit/api/drivers/amphora_driver/v1/test_driver.py @@ -259,8 +259,19 @@ class TestAmphoraDriver(base.TestRpc): old_provider_pool = driver_dm.Pool( pool_id=self.sample_data.pool1_id) provider_pool = driver_dm.Pool( - pool_id=self.sample_data.pool1_id, admin_state_up=True) - pool_dict = {'enabled': True} + pool_id=self.sample_data.pool1_id, admin_state_up=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) payload = {consts.POOL_ID: self.sample_data.pool1_id, consts.POOL_UPDATES: pool_dict} diff --git a/octavia/tests/unit/api/drivers/amphora_driver/v2/test_driver.py b/octavia/tests/unit/api/drivers/amphora_driver/v2/test_driver.py index 9eab8db234..5716975744 100644 --- a/octavia/tests/unit/api/drivers/amphora_driver/v2/test_driver.py +++ b/octavia/tests/unit/api/drivers/amphora_driver/v2/test_driver.py @@ -261,8 +261,19 @@ class TestAmphoraDriver(base.TestRpc): old_provider_pool = driver_dm.Pool( pool_id=self.sample_data.pool1_id) provider_pool = driver_dm.Pool( - pool_id=self.sample_data.pool1_id, admin_state_up=True) - pool_dict = {'enabled': True} + pool_id=self.sample_data.pool1_id, admin_state_up=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) payload = {consts.ORIGINAL_POOL: old_provider_pool.to_dict(), consts.POOL_UPDATES: pool_dict} diff --git a/releasenotes/notes/fix-pool-crl-2cc6f2705f5b2009.yaml b/releasenotes/notes/fix-pool-crl-2cc6f2705f5b2009.yaml new file mode 100644 index 0000000000..6d17b98f1d --- /dev/null +++ b/releasenotes/notes/fix-pool-crl-2cc6f2705f5b2009.yaml @@ -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.