diff --git a/octavia/controller/worker/v2/tasks/amphora_driver_tasks.py b/octavia/controller/worker/v2/tasks/amphora_driver_tasks.py index bffc022bc6..fdf91d23d1 100644 --- a/octavia/controller/worker/v2/tasks/amphora_driver_tasks.py +++ b/octavia/controller/worker/v2/tasks/amphora_driver_tasks.py @@ -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: diff --git a/octavia/tests/unit/controller/worker/v2/tasks/test_amphora_driver_tasks.py b/octavia/tests/unit/controller/worker/v2/tasks/test_amphora_driver_tasks.py index 3e80e3df59..28de5af50e 100644 --- a/octavia/tests/unit/controller/worker/v2/tasks/test_amphora_driver_tasks.py +++ b/octavia/tests/unit/controller/worker/v2/tasks/test_amphora_driver_tasks.py @@ -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, diff --git a/releasenotes/notes/fix-host-routes-with-amphorav2-and-persistence-54b99d651a4ee9c4.yaml b/releasenotes/notes/fix-host-routes-with-amphorav2-and-persistence-54b99d651a4ee9c4.yaml new file mode 100644 index 0000000000..24a859073e --- /dev/null +++ b/releasenotes/notes/fix-host-routes-with-amphorav2-and-persistence-54b99d651a4ee9c4.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fix a serialization error when using host_routes in VIP subnets when + persistence in the amphorav2 driver is enabled.