Skip to content

Commit da8f6ef

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 (cherry picked from commit 5bdd0ef) Conflicts: neutron/tests/unit/fake_resources.py
1 parent 75eefdb commit da8f6ef

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
@@ -1983,7 +1983,8 @@ def set_gateway_mtu(self, context, prov_net, txn=None):
19831983
for port in ports:
19841984
lrp_name = utils.ovn_lrouter_port_name(port['id'])
19851985
options = self._gen_router_port_options(port, prov_net)
1986-
commands.append(self._nb_idl.lrp_set_options(lrp_name, **options))
1986+
commands.append(self._nb_idl.update_lrouter_port(
1987+
lrp_name, if_exists=True, **options))
19871988
self._transaction(commands, txn=txn)
19881989

19891990
def _check_network_changes_in_ha_chassis_groups(self, context, lswitch,

neutron/tests/unit/fake_resources.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def __init__(self, **kwargs):
6262
self.get_acls_for_lswitches = mock.Mock()
6363
self.create_lrouter = mock.Mock()
6464
self.lrp_del = mock.Mock()
65-
self.lrp_set_options = mock.Mock()
6665
self.update_lrouter = mock.Mock()
6766
self.delete_lrouter = mock.Mock()
6867
self.add_lrouter_port = 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
@@ -2484,8 +2484,8 @@ def _test_update_network_fragmentation(self, new_mtu, expected_opts, grps):
24842484
self.mech_driver.update_network_postcommit(fake_ctx)
24852485

24862486
lrp_name = ovn_utils.ovn_lrouter_port_name(port['port']['id'])
2487-
self.nb_ovn.lrp_set_options.assert_called_once_with(
2488-
lrp_name, **expected_opts)
2487+
self.nb_ovn.update_lrouter_port.assert_called_once_with(
2488+
lrp_name, if_exists=True, **expected_opts)
24892489

24902490
def test_update_network_need_to_frag_enabled(self):
24912491
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
@@ -1689,7 +1689,7 @@ def test_add_router_interface_need_to_frag_enabled_then_remove(
16891689
self.l3_inst._nb_ovn.add_lrouter_port.assert_called_once_with(
16901690
**fake_router_port_assert)
16911691
# Since if_exists = True it will safely return
1692-
self.l3_inst._nb_ovn.lrp_set_options(
1692+
self.l3_inst._nb_ovn.update_lrouter_port(
16931693
name='lrp-router-port-id', if_exists=True,
16941694
options=fake_router_port_assert)
16951695
# If no if_exists is provided, it is defaulted to true, so this

0 commit comments

Comments
 (0)