Fix using host_routes in VIP subnet with amphorav2
Ensure that amphorae_network_config parameter is not modified in AmphoraPostVIPPlug. Modifying it would break amphorav2 persistence by introducing non-serializable elements in the subnet dict Story: 2008955 Task: 42580 Change-Id: I8f0d3ba1d083c7e37e7e26617826400a538a0890
This commit is contained in:
parent
1d77e93f28
commit
76606b4c4d
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
import copy
|
||||
from cryptography import fernet
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -334,8 +335,9 @@ class AmphoraPostVIPPlug(BaseAmphoraTask):
|
||||
**amphorae_network_config[
|
||||
amphora.get(constants.ID)][constants.VRRP_PORT])
|
||||
# Required for noop-case
|
||||
vip_arg = amphorae_network_config[amphora.get(
|
||||
constants.ID)][constants.VIP_SUBNET]
|
||||
vip_arg = copy.deepcopy(
|
||||
amphorae_network_config[
|
||||
amphora.get(constants.ID)][constants.VIP_SUBNET])
|
||||
if vip_arg:
|
||||
host_routes = vip_arg.get('host_routes')
|
||||
if host_routes:
|
||||
|
@ -630,6 +630,11 @@ class TestAmphoraDriverTasks(base.TestCase):
|
||||
self.assertEqual(hr1['destination'], hr2.destination)
|
||||
self.assertEqual(hr1['nexthop'], hr2.nexthop)
|
||||
|
||||
self.assertEqual(
|
||||
host_routes,
|
||||
amphorae_net_config_mock[AMP_ID][
|
||||
constants.VIP_SUBNET]['host_routes'])
|
||||
|
||||
@mock.patch('octavia.db.repositories.LoadBalancerRepository.update')
|
||||
@mock.patch('octavia.db.repositories.LoadBalancerRepository.get')
|
||||
def test_amphorae_post_vip_plug(self, mock_lb_get,
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fix a serialization error when using host_routes in VIP subnets when
|
||||
persistence in the amphorav2 driver is enabled.
|
Loading…
Reference in New Issue
Block a user