summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Libosvar <libosvar@redhat.com>2022-09-10 21:27:15 +0000
committerKrzysztof Tomaszewski <krzysztof.tomaszewski@labedz.org>2022-10-31 15:11:46 +0100
commitc968f40967221f1b8e001a20b4868cbf53422693 (patch)
tree2494d177c23fae03a8c6e8269aab067a6b76c198
parent98e2fd47fe6bcb0d4870c58b1533746fe8c57608 (diff)
downloadneutron-c968f40967221f1b8e001a20b4868cbf53422693.tar.gz
Revert "[OVN] Set NB/SB "connection" inactivity probe"
This reverts commit 28f3017a90ecec6208aef9696cd7947972ec17d8. Reason for revert: It breaks Neutron server to start if OVN database is large. Also Neutron server shouldn't be configuring other services, it should be done rather by an installer. Change-Id: Ia1dc8072ecec1c019dd02039dadd78d544dbd843 (cherry picked from commit 30d1a40c508386905b12c43be1891ce503a8b634)
-rw-r--r--neutron/common/ovn/utils.py20
-rw-r--r--neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py24
-rw-r--r--neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovsdb_monitor.py1
-rw-r--r--neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py52
-rw-r--r--neutron/tests/unit/common/ovn/test_utils.py16
5 files changed, 0 insertions, 113 deletions
diff --git a/neutron/common/ovn/utils.py b/neutron/common/ovn/utils.py
index 13e8fc5a2d..7e2725fcf6 100644
--- a/neutron/common/ovn/utils.py
+++ b/neutron/common/ovn/utils.py
@@ -613,23 +613,3 @@ def parse_ovn_lb_port_forwarding(ovn_rtr_lb_pfs):
def get_network_name_from_datapath(datapath):
return datapath.external_ids['name'].replace('neutron-', '')
-
-
-def connection_config_to_target_string(connection_config):
- """Converts the Neutron NB/SB connection parameter to the OVN target string
-
- :param connection_config: Neutron OVN config parameter for the OVN NB or SB
- database. See "ovn_sb_connection" or
- "ovn_nb_connection" params.
- :returns: (String) OVN NB/SB ``connection.target`` column value.
- """
- regex = re.compile(r'^(?P<proto>\w+)\:((?P<ip>.+)\:(?P<port>\d+)|'
- r'(?P<file>[\w\/\.]+))')
- m = regex.match(connection_config)
- if m:
- _dict = m.groupdict()
- if _dict['ip'] and _dict['port']:
- return ('p' + _dict['proto'] + ':' + _dict['port'] + ':' +
- _dict['ip'])
- elif _dict['file']:
- return 'p' + _dict['proto'] + ':' + _dict['file']
diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py
index 5f8a934707..6554e46991 100644
--- a/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py
+++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py
@@ -40,7 +40,6 @@ from oslo_config import cfg
from oslo_db import exception as os_db_exc
from oslo_log import log
from oslo_utils import timeutils
-from ovsdbapp.backend.ovs_idl import idlutils
from neutron._i18n import _
from neutron.common.ovn import acl as ovn_acl
@@ -237,7 +236,6 @@ class OVNMechanismDriver(api.MechanismDriver):
atexit.register(self._clean_hash_ring)
signal.signal(signal.SIGTERM, self._clean_hash_ring)
self._create_neutron_pg_drop()
- self._set_inactivity_probe()
def _create_neutron_pg_drop(self):
"""Create neutron_pg_drop Port Group.
@@ -274,28 +272,6 @@ class OVNMechanismDriver(api.MechanismDriver):
else:
raise
- def _set_inactivity_probe(self):
- """Set 'connection.inactivity_probe' in NB and SB databases"""
- inactivity_probe = ovn_conf.get_ovn_ovsdb_probe_interval()
- dbs = [(ovn_conf.get_ovn_nb_connection(), 'OVN_Northbound',
- impl_idl_ovn.OvsdbNbOvnIdl),
- (ovn_conf.get_ovn_sb_connection(), 'OVN_Southbound',
- impl_idl_ovn.OvsdbSbOvnIdl)]
- for connection, schema, klass in dbs:
- target = ovn_utils.connection_config_to_target_string(connection)
- if not target:
- continue
-
- idl = ovsdb_monitor.BaseOvnIdl.from_server(connection, schema)
- with ovsdb_monitor.short_living_ovsdb_api(klass, idl) as idl_api:
- conn = idlutils.row_by_value(idl_api, 'Connection', 'target',
- target, None)
- if conn:
- idl_api.db_set(
- 'Connection', target,
- ('inactivity_probe', int(inactivity_probe))).execute(
- check_error=True)
-
@staticmethod
def should_post_fork_initialize(worker_class):
return worker_class in (neutron.wsgi.WorkerService,
diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovsdb_monitor.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovsdb_monitor.py
index 696d7f3efa..563e4cfe0a 100644
--- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovsdb_monitor.py
+++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovsdb_monitor.py
@@ -669,7 +669,6 @@ class OvnSbIdl(OvnIdlDistributedLock):
helper.register_table('Encap')
helper.register_table('Port_Binding')
helper.register_table('Datapath_Binding')
- helper.register_table('Connection')
helper.register_columns('SB_Global', ['external_ids'])
try:
return cls(driver, connection_string, helper, leader_only=False)
diff --git a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py
index dac6459614..d61d2abc73 100644
--- a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py
+++ b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py
@@ -27,7 +27,6 @@ from oslo_utils import uuidutils
from ovsdbapp.backend.ovs_idl import event
from ovsdbapp.tests.functional import base as ovs_base
-from neutron.agent.linux import utils as linux_utils
from neutron.common.ovn import constants as ovn_const
from neutron.common.ovn import utils
from neutron.common import utils as n_utils
@@ -999,54 +998,3 @@ class TestAgentApi(base.TestOVNFunctionalBase):
self.plugin.delete_agent(self.context, agent_id)
self.assertRaises(agent_exc.AgentNotFound, self.plugin.get_agent,
self.context, agent_id)
-
-
-class ConnectionInactivityProbeSetEvent(event.WaitEvent):
- """Wait for a Connection (NB/SB) to have the inactivity probe set"""
-
- ONETIME = False
-
- def __init__(self, target, inactivity_probe):
- table = 'Connection'
- events = (self.ROW_UPDATE,)
- super().__init__(events, table, None)
- self.event_name = "ConnectionEvent"
- self.target = target
- self.inactivity_probe = inactivity_probe
-
- def match_fn(self, event, row, old):
- return row.target in self.target
-
- def run(self, event, row, old):
- if (row.inactivity_probe and
- row.inactivity_probe[0] == self.inactivity_probe):
- self.event.set()
-
-
-class TestSetInactivityProbe(base.TestOVNFunctionalBase):
-
- def setUp(self):
- super().setUp()
- self.dbs = [(ovn_conf.get_ovn_nb_connection(), 'ptcp:1000:1.2.3.4'),
- (ovn_conf.get_ovn_sb_connection(), 'ptcp:1001:1.2.3.4')]
- linux_utils.execute(
- ['ovn-nbctl', '--db=%s' % self.dbs[0][0],
- 'set-connection', self.dbs[0][1]], run_as_root=True)
- linux_utils.execute(
- ['ovn-sbctl', '--db=%s' % self.dbs[1][0],
- 'set-connection', self.dbs[1][1]], run_as_root=True)
-
- def test_1(self):
- mock.patch.object(ovn_conf, 'get_ovn_ovsdb_probe_interval',
- return_value='2500').start()
- nb_connection = ConnectionInactivityProbeSetEvent(self.dbs[0][1], 2500)
- sb_connection = ConnectionInactivityProbeSetEvent(self.dbs[1][1], 2500)
- self.nb_api.idl.notify_handler.watch_event(nb_connection)
- self.sb_api.idl.notify_handler.watch_event(sb_connection)
- with mock.patch.object(utils, 'connection_config_to_target_string') \
- as mock_target:
- mock_target.side_effect = [self.dbs[0][1], self.dbs[1][1]]
- self.mech_driver._set_inactivity_probe()
-
- self.assertTrue(nb_connection.wait())
- self.assertTrue(sb_connection.wait())
diff --git a/neutron/tests/unit/common/ovn/test_utils.py b/neutron/tests/unit/common/ovn/test_utils.py
index 8911e777e0..c3df305045 100644
--- a/neutron/tests/unit/common/ovn/test_utils.py
+++ b/neutron/tests/unit/common/ovn/test_utils.py
@@ -320,22 +320,6 @@ class TestDHCPUtils(base.BaseTestCase):
self.assertEqual(expected_options, options)
-class TestConnectionConfigToTargetString(base.BaseTestCase):
-
- def test_strings(self):
- config_target = (
- ('ssl:1.2.3.4:5678', 'pssl:5678:1.2.3.4'),
- ('tcp:1.2.3.4:5678', 'ptcp:5678:1.2.3.4'),
- ('ssl:[::1]:5678', 'pssl:5678:[::1]'),
- ('tcp:[::1]:5678', 'ptcp:5678:[::1]'),
- ('unix:/var/run/ovs/db.sock', 'punix:/var/run/ovs/db.sock'),
- ('wrong_value', None))
-
- for config, target in config_target:
- output = utils.connection_config_to_target_string(config)
- self.assertEqual(target, output)
-
-
class TestGetDhcpDnsServers(base.BaseTestCase):
def test_ipv4(self):