Skip to content

Commit ae1540b

Browse files
jumpojoypriteau
andcommitted
Maintenance task: do not change IPv4 ip_port_mappings
IPv4 port mappings would get cleared by format_ip_port_mappings_ipv6(), breaking load balancers with health monitors. Change-Id: Ia29fd3c533b40f6eb13278a163ebb95465d77a99 Closes-Bug: #2072754 Co-Authored-By: Pierre Riteau <[email protected]>
1 parent b5d8693 commit ae1540b

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

ovn_octavia_provider/maintenance.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,13 @@ def format_ip_port_mappings_ipv6(self):
152152
break
153153
port_uuid, src_ip = v.split(':', 1)
154154
mappings[f'[{k}]'] = f'{port_uuid}:[{src_ip}]'
155-
self.ovn_nbdb_api.db_clear('Load_Balancer', lb.uuid,
156-
'ip_port_mappings').execute(
157-
check_error=True)
158-
self.ovn_nbdb_api.db_set('Load_Balancer', lb.uuid,
159-
('ip_port_mappings', mappings)).execute(
160-
check_error=True)
155+
if mappings:
156+
self.ovn_nbdb_api.db_clear(
157+
'Load_Balancer', lb.uuid, 'ip_port_mappings'
158+
).execute(check_error=True)
159+
self.ovn_nbdb_api.db_set(
160+
'Load_Balancer', lb.uuid, ('ip_port_mappings', mappings)
161+
).execute(check_error=True)
161162

162163
LOG.debug('Maintenance task: no more ip_port_mappings to format, '
163164
'stopping the periodic task.')

ovn_octavia_provider/tests/unit/test_maintenance.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,7 @@ def test_format_ip_port_mappings_ipv6(self, net_cli):
182182
'[fda2:918e:5869:0:f816:3eff:fe64:adf8]':
183183
'f2b97caf-da62-4db9-91da-bc11f2ac3935:'
184184
'[fda2:918e:5869:0:f816:3eff:fe81:61d0]'}
185-
expected_call_db_clear = [
186-
mock.call('Load_Balancer', 'foo1', 'ip_port_mappings')]
187-
self.maint.ovn_nbdb_api.db_clear.assert_has_calls(
188-
expected_call_db_clear)
189-
expected_call_db_set = [
190-
mock.call('Load_Balancer', 'foo1', ('ip_port_mappings', mapping1))]
191-
self.maint.ovn_nbdb_api.db_set.assert_has_calls(
192-
expected_call_db_set)
185+
self.maint.ovn_nbdb_api.db_clear.assert_called_once_with(
186+
'Load_Balancer', 'foo1', 'ip_port_mappings')
187+
self.maint.ovn_nbdb_api.db_set.assert_called_once_with(
188+
'Load_Balancer', 'foo1', ('ip_port_mappings', mapping1))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
[`bug 2072754 <https://bugs.launchpad.net/neutron/+bug/2072754>`_]
5+
Fixed maintenance task that was breaking IPv4 load balancers with health
6+
monitors.

0 commit comments

Comments
 (0)