Merge "[OVN] Fix: Disabling snat after it was enabled"

This commit is contained in:
Zuul 2021-05-20 15:40:37 +00:00 committed by Gerrit Code Review
commit 798fd70b91
2 changed files with 4 additions and 7 deletions

View File

@ -1219,11 +1219,10 @@ class OVNClient(object):
else:
# Check if snat has been enabled/disabled and update
new_snat_state = gateway_new.get('enable_snat', True)
if bool(ovn_snats) != new_snat_state:
if utils.is_snat_enabled(new_router) and networks:
self.update_nat_rules(
new_router, networks,
enable_snat=new_snat_state, txn=txn)
if bool(ovn_snats) != new_snat_state and networks:
self.update_nat_rules(
new_router, networks,
enable_snat=new_snat_state, txn=txn)
update = {'external_ids': self._gen_router_ext_ids(new_router)}
update['enabled'] = new_router.get('admin_state_up') or False

View File

@ -891,8 +891,6 @@ class TestOVNL3RouterPlugin(test_mech_driver.Ml2PluginV2TestCase):
'ovn_client.OVNClient._check_external_ips_changed')
@mock.patch.object(utils, 'get_lrouter_snats')
@mock.patch.object(utils, 'get_lrouter_ext_gw_static_route')
@mock.patch('neutron.common.ovn.utils.is_snat_enabled',
mock.Mock(return_value=True))
@mock.patch('neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb.'
'ovn_client.OVNClient._get_router_ports')
@mock.patch('neutron.db.extraroute_db.ExtraRoute_dbonly_mixin.'