Skip to content

Commit 5bdd0ef

Browse files
committed
[stable only] Do not fail on missing logical router ports
set_gateway_mtu runs for all the gateway ports for a network and if one of the ports get's deleted in meanwhile whole transaction fails. To handle this we need to add if_exists=True to the transaction but for that it needs to be supported in ovsdbapp. It's fixed in ovsdbapp with [1] but would require to bump ovsdbapp minimal version in requirements.txt which we normally don't do for stable branches. So using "update_lrouter_port" instead as that have the required option available. Before [2] that was only used but during the switch if_exists part was missed. [1] https://review.opendev.org/q/I56685478214aae7b6d3a2a3187297ad4eb1869a3 [2] https://review.opendev.org/c/openstack/neutron/+/762695 Closes-Bug: #2065701 Related-Bug: #2060163 Change-Id: I447990509cdea9830228d3bc92a97062cc57a472
1 parent d8208fc commit 5bdd0ef

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,8 @@ def set_gateway_mtu(self, context, prov_net, txn=None):
20582058
for port in ports:
20592059
lrp_name = utils.ovn_lrouter_port_name(port['id'])
20602060
options = self._gen_router_port_options(port, prov_net)
2061-
commands.append(self._nb_idl.lrp_set_options(lrp_name, **options))
2061+
commands.append(self._nb_idl.update_lrouter_port(
2062+
lrp_name, if_exists=True, **options))
20622063
self._transaction(commands, txn=txn)
20632064

20642065
def _check_network_changes_in_ha_chassis_groups(self,

neutron/tests/unit/fake_resources.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def __init__(self, **kwargs):
6363
self.delete_lswitch_port = mock.Mock()
6464
self.get_acls_for_lswitches = mock.Mock()
6565
self.lrp_del = mock.Mock()
66-
self.lrp_set_options = mock.Mock()
6766
self.lr_add = mock.Mock()
6867
self.update_lrouter = mock.Mock()
6968
self.lr_del = mock.Mock()

neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,8 +2573,8 @@ def _test_update_network_fragmentation(self, new_mtu, expected_opts, grps,
25732573
self.mech_driver.update_network_postcommit(fake_ctx)
25742574

25752575
lrp_name = ovn_utils.ovn_lrouter_port_name(port['port']['id'])
2576-
self.nb_ovn.lrp_set_options.assert_called_once_with(
2577-
lrp_name, **expected_opts)
2576+
self.nb_ovn.update_lrouter_port.assert_called_once_with(
2577+
lrp_name, if_exists=True, **expected_opts)
25782578

25792579
def test_update_network_need_to_frag_enabled(self):
25802580
ovn_conf.cfg.CONF.set_override('ovn_emit_need_to_frag', True,

neutron/tests/unit/services/ovn_l3/test_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ def test_add_router_interface_need_to_frag_enabled_then_remove(
19871987
self.l3_inst._nb_ovn.add_lrouter_port.assert_called_once_with(
19881988
**fake_router_port_assert)
19891989
# Since if_exists = True it will safely return
1990-
self.l3_inst._nb_ovn.lrp_set_options(
1990+
self.l3_inst._nb_ovn.update_lrouter_port(
19911991
name='lrp-router-port-id', if_exists=True,
19921992
options=fake_router_port_assert)
19931993
# If no if_exists is provided, it is defaulted to true, so this

0 commit comments

Comments
 (0)