Skip to content

Commit c002627

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Revert "[OVN] Set NB/SB "connection" inactivity probe"" into stable/yoga
2 parents 897b474 + f2ec373 commit c002627

File tree

5 files changed

+0
-116
lines changed

5 files changed

+0
-116
lines changed

neutron/common/ovn/utils.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import copy
1515
import inspect
1616
import os
17-
import re
1817

1918
import netaddr
2019
from neutron_lib.api.definitions import external_net
@@ -686,23 +685,3 @@ def is_port_external(port):
686685

687686
return (vnic_type in constants.EXTERNAL_PORT_TYPES and
688687
constants.PORT_CAP_SWITCHDEV not in capabilities)
689-
690-
691-
def connection_config_to_target_string(connection_config):
692-
"""Converts the Neutron NB/SB connection parameter to the OVN target string
693-
694-
:param connection_config: Neutron OVN config parameter for the OVN NB or SB
695-
database. See "ovn_sb_connection" or
696-
"ovn_nb_connection" params.
697-
:returns: (String) OVN NB/SB ``connection.target`` column value.
698-
"""
699-
regex = re.compile(r'^(?P<proto>\w+)\:((?P<ip>.+)\:(?P<port>\d+)|'
700-
r'(?P<file>[\w\/\.]+))')
701-
m = regex.match(connection_config)
702-
if m:
703-
_dict = m.groupdict()
704-
if _dict['ip'] and _dict['port']:
705-
return ('p' + _dict['proto'] + ':' + _dict['port'] + ':' +
706-
_dict['ip'])
707-
elif _dict['file']:
708-
return 'p' + _dict['proto'] + ':' + _dict['file']

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
from oslo_db import exception as os_db_exc
4040
from oslo_log import log
4141
from oslo_utils import timeutils
42-
from ovsdbapp.backend.ovs_idl import idlutils
4342

4443
from neutron._i18n import _
4544
from neutron.common.ovn import acl as ovn_acl
@@ -280,7 +279,6 @@ def pre_fork_initialize(self, resource, event, trigger, payload=None):
280279
atexit.register(self._clean_hash_ring)
281280
signal.signal(signal.SIGTERM, self._clean_hash_ring)
282281
self._create_neutron_pg_drop()
283-
self._set_inactivity_probe()
284282

285283
def _create_neutron_pg_drop(self):
286284
"""Create neutron_pg_drop Port Group.
@@ -322,28 +320,6 @@ def _create_neutron_pg_drop(self):
322320
LOG.info("Porg Group %(pg)s was created by another server",
323321
{'pg': ovn_const.OVN_DROP_PORT_GROUP_NAME})
324322

325-
def _set_inactivity_probe(self):
326-
"""Set 'connection.inactivity_probe' in NB and SB databases"""
327-
inactivity_probe = ovn_conf.get_ovn_ovsdb_probe_interval()
328-
dbs = [(ovn_conf.get_ovn_nb_connection(), self.nb_schema_helper,
329-
impl_idl_ovn.OvsdbNbOvnIdl),
330-
(ovn_conf.get_ovn_sb_connection(), self.sb_schema_helper,
331-
impl_idl_ovn.OvsdbSbOvnIdl)]
332-
for connection, schema, klass in dbs:
333-
target = ovn_utils.connection_config_to_target_string(connection)
334-
if not target:
335-
continue
336-
337-
idl = ovsdb_monitor.BaseOvnIdl.from_server(connection, schema)
338-
with ovsdb_monitor.short_living_ovsdb_api(klass, idl) as idl_api:
339-
conn = idlutils.row_by_value(idl_api, 'Connection', 'target',
340-
target, None)
341-
if conn:
342-
idl_api.db_set(
343-
'Connection', target,
344-
('inactivity_probe', int(inactivity_probe))).execute(
345-
check_error=True)
346-
347323
@staticmethod
348324
def should_post_fork_initialize(worker_class):
349325
return worker_class in (neutron.wsgi.WorkerService,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,6 @@ def from_server(cls, connection_string, helper, driver):
815815
helper.register_table('Encap')
816816
helper.register_table('Port_Binding')
817817
helper.register_table('Datapath_Binding')
818-
helper.register_table('Connection')
819818
helper.register_columns('SB_Global', ['external_ids'])
820819
try:
821820
return cls(driver, connection_string, helper, leader_only=False)

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

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from ovsdbapp.backend.ovs_idl import event
3030
from ovsdbapp.tests.functional import base as ovs_base
3131

32-
from neutron.agent.linux import utils as linux_utils
3332
from neutron.common.ovn import constants as ovn_const
3433
from neutron.common.ovn import utils
3534
from neutron.common import utils as n_utils
@@ -1220,56 +1219,3 @@ def test_agent_delete(self):
12201219
self.plugin.delete_agent(self.context, metadata_id)
12211220
self.assertRaises(agent_exc.AgentNotFound, self.plugin.get_agent,
12221221
self.context, metadata_id)
1223-
1224-
1225-
class ConnectionInactivityProbeSetEvent(event.WaitEvent):
1226-
"""Wait for a Connection (NB/SB) to have the inactivity probe set"""
1227-
1228-
ONETIME = False
1229-
1230-
def __init__(self, target, inactivity_probe):
1231-
table = 'Connection'
1232-
events = (self.ROW_UPDATE,)
1233-
super().__init__(events, table, None)
1234-
self.event_name = "ConnectionEvent"
1235-
self.target = target
1236-
self.inactivity_probe = inactivity_probe
1237-
1238-
def match_fn(self, event, row, old):
1239-
return row.target in self.target
1240-
1241-
def run(self, event, row, old):
1242-
if (row.inactivity_probe and
1243-
row.inactivity_probe[0] == self.inactivity_probe):
1244-
self.event.set()
1245-
1246-
1247-
class TestSetInactivityProbe(base.TestOVNFunctionalBase):
1248-
1249-
def setUp(self):
1250-
super().setUp()
1251-
self.dbs = [(ovn_conf.get_ovn_nb_connection(), 'ptcp:1000:1.2.3.4'),
1252-
(ovn_conf.get_ovn_sb_connection(), 'ptcp:1001:1.2.3.4')]
1253-
linux_utils.execute(
1254-
['ovn-nbctl', '--db=%s' % self.dbs[0][0],
1255-
'set-connection', self.dbs[0][1]], run_as_root=True,
1256-
privsep_exec=True)
1257-
linux_utils.execute(
1258-
['ovn-sbctl', '--db=%s' % self.dbs[1][0],
1259-
'set-connection', self.dbs[1][1]], run_as_root=True,
1260-
privsep_exec=True)
1261-
1262-
def test_1(self):
1263-
mock.patch.object(ovn_conf, 'get_ovn_ovsdb_probe_interval',
1264-
return_value='2500').start()
1265-
nb_connection = ConnectionInactivityProbeSetEvent(self.dbs[0][1], 2500)
1266-
sb_connection = ConnectionInactivityProbeSetEvent(self.dbs[1][1], 2500)
1267-
self.nb_api.idl.notify_handler.watch_event(nb_connection)
1268-
self.sb_api.idl.notify_handler.watch_event(sb_connection)
1269-
with mock.patch.object(utils, 'connection_config_to_target_string') \
1270-
as mock_target:
1271-
mock_target.side_effect = [self.dbs[0][1], self.dbs[1][1]]
1272-
self.mech_driver._set_inactivity_probe()
1273-
1274-
self.assertTrue(nb_connection.wait())
1275-
self.assertTrue(sb_connection.wait())

neutron/tests/unit/common/ovn/test_utils.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -373,22 +373,6 @@ def test_get_lsp_dhcp_opts(self):
373373
self.assertEqual(expected_options, options)
374374

375375

376-
class TestConnectionConfigToTargetString(base.BaseTestCase):
377-
378-
def test_strings(self):
379-
config_target = (
380-
('ssl:1.2.3.4:5678', 'pssl:5678:1.2.3.4'),
381-
('tcp:1.2.3.4:5678', 'ptcp:5678:1.2.3.4'),
382-
('ssl:[::1]:5678', 'pssl:5678:[::1]'),
383-
('tcp:[::1]:5678', 'ptcp:5678:[::1]'),
384-
('unix:/var/run/ovs/db.sock', 'punix:/var/run/ovs/db.sock'),
385-
('wrong_value', None))
386-
387-
for config, target in config_target:
388-
output = utils.connection_config_to_target_string(config)
389-
self.assertEqual(target, output)
390-
391-
392376
class TestGetDhcpDnsServers(base.BaseTestCase):
393377

394378
def test_ipv4(self):

0 commit comments

Comments
 (0)