Browse Source

[ovn] Add timeout option to ovsdb-client command

Today, we invoke ovsdb-client to cleanup the MAC_Binding entries
without specifying any timeout. This can lead to workers blocking
forever if there's an issue with the connection to the server.

This patch is adding a timeout parameter to the command line to
prevent this condition.

Closes-Bug: #1948891
Related-Bug: #1946318

(Manually cherry picked from Neutron 7874c576013928c036dca4d9c0a38e5b8ae06bb4)

Signed-off-by: Daniel Alvarez Sanchez <dalvarez@redhat.com>
Change-Id: Id393cbec31dd64a795e85d756b7b843c9dfc59f3
changes/03/818803/1
Lucas Alvares Gomes 6 months ago
parent
commit
4131acbea8
  1. 3
      networking_ovn/ml2/mech_driver.py
  2. 5
      networking_ovn/tests/unit/ml2/test_mech_driver.py

3
networking_ovn/ml2/mech_driver.py

@ -959,7 +959,8 @@ class OVNMechanismDriver(api.MechanismDriver):
def delete_mac_binding_entries(self, external_ip):
"""Delete all MAC_Binding entries associated to this IP address"""
cmd = ['ovsdb-client', 'transact', config.get_ovn_sb_connection()]
cmd = ['ovsdb-client', 'transact', config.get_ovn_sb_connection(),
'--timeout', str(config.get_ovn_ovsdb_timeout())]
if config.get_ovn_sb_private_key():
cmd += ['-p', config.get_ovn_sb_private_key(), '-c',

5
networking_ovn/tests/unit/ml2/test_mech_driver.py

@ -86,6 +86,7 @@ class TestOVNMechanismDriver(test_plugin.Ml2PluginV2TestCase):
self.mech_driver = mm.mech_drivers['ovn'].obj
self.mech_driver._nb_ovn = fakes.FakeOvsdbNbOvnIdl()
self.mech_driver._sb_ovn = fakes.FakeOvsdbSbOvnIdl()
cfg.CONF.set_override('ovsdb_connection_timeout', 30, group='ovn')
self.nb_ovn = self.mech_driver._nb_ovn
self.sb_ovn = self.mech_driver._sb_ovn
@ -113,7 +114,7 @@ class TestOVNMechanismDriver(test_plugin.Ml2PluginV2TestCase):
def test_delete_mac_binding_entries(self):
self.config(group='ovn', ovn_sb_private_key=None)
expected = ('ovsdb-client transact tcp:127.0.0.1:6642 '
expected = ('ovsdb-client transact tcp:127.0.0.1:6642 --timeout 30 '
'\'["OVN_Southbound", {"op": "delete", "table": '
'"MAC_Binding", "where": [["ip", "==", "1.1.1.1"]]}]\'')
with mock.patch.object(processutils, 'execute') as mock_execute:
@ -125,7 +126,7 @@ class TestOVNMechanismDriver(test_plugin.Ml2PluginV2TestCase):
self.config(group='ovn', ovn_sb_private_key='pk')
self.config(group='ovn', ovn_sb_certificate='cert')
self.config(group='ovn', ovn_sb_ca_cert='ca')
expected = ('ovsdb-client transact tcp:127.0.0.1:6642 '
expected = ('ovsdb-client transact tcp:127.0.0.1:6642 --timeout 30 '
'-p pk -c cert -C ca '
'\'["OVN_Southbound", {"op": "delete", "table": '
'"MAC_Binding", "where": [["ip", "==", "1.1.1.1"]]}]\'')

Loading…
Cancel
Save