From 580027b7c9f12e005a93a3aae378c486f50cc642 Mon Sep 17 00:00:00 2001 From: maximkorezkij Date: Mon, 5 Jun 2023 11:20:47 +0200 Subject: [PATCH 1/2] [neutron-api] remove leader_only for sb connection The maintenance worker from the neutron-api uses a southbound connection. Since the southbound does not use any locking and all the ovsdb locking is used for the northbound this changes should not have a big impact. This commit removes the leader_only flag for the maintenance worker. This should also enable the neutron api to connect to relays instead of only the sb directly. Closes-Bug: #2022914 Change-Id: Ia7937390867e45af34ebcd65bd76fc89b6adafe9 Signed-off-by: maximkorezkij (cherry picked from commit a9c8bf5c069d3324828294e3e36b5374d5a828fe) --- .../ml2/drivers/ovn/mech_driver/ovsdb/ovsdb_monitor.py | 3 +-- releasenotes/notes/bug-2022914-edbf1ea3514596b8.yaml | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-2022914-edbf1ea3514596b8.yaml 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 f089077a05b..2b5ef1960d3 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 @@ -659,9 +659,8 @@ def from_server(cls, connection_string, helper): helper.register_table('Encap') helper.register_table('Port_Binding') helper.register_table('Datapath_Binding') - # Used by MaintenanceWorker which can use ovsdb locking try: - return cls(connection_string, helper, leader_only=True) + return cls(connection_string, helper, leader_only=False) except TypeError: # TODO(twilson) We can remove this when we require ovs>=2.12.0 return cls(connection_string, helper) diff --git a/releasenotes/notes/bug-2022914-edbf1ea3514596b8.yaml b/releasenotes/notes/bug-2022914-edbf1ea3514596b8.yaml new file mode 100644 index 00000000000..6fa3b3a5138 --- /dev/null +++ b/releasenotes/notes/bug-2022914-edbf1ea3514596b8.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + [`bug 2022914 `_] + Neutron-API supports using relays as the southbound connection in a + ML2/OVN setup. Before the maintenance worker of the API required a + leader_only connection, which was removed. From ef31c17cb865eb9f591714d692c5ff5851076b2f Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Wed, 16 Aug 2023 12:14:19 +0200 Subject: [PATCH 2/2] Use HasStandardAttributes as parent class for Tags DB model Tags db model class had defined standard attribute relationship as "subquery" which leads to massive number of SELECT sql queries to get those standard attributes for any tag. With this patch this db model will use relationship definition from the HasStandardAttributes class which is the same for all models with standard attributes and which is "joined" model. Change-Id: If11288c89c362c8d6f97833d89b3df77e51ee363 (cherry picked from commit 85d3fff97e55ba85f72cda4365ad0441c10bd9f6) --- neutron/db/models/tag.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/db/models/tag.py b/neutron/db/models/tag.py index 55195340d03..14e680fccc7 100644 --- a/neutron/db/models/tag.py +++ b/neutron/db/models/tag.py @@ -26,6 +26,6 @@ class Tag(model_base.BASEV2): tag = sa.Column(sa.String(255), nullable=False, primary_key=True) standard_attr = orm.relationship( 'StandardAttribute', load_on_pending=True, - backref=orm.backref('tags', lazy='subquery', viewonly=True), + backref=orm.backref('tags', lazy='joined', viewonly=True), sync_backref=False) revises_on_change = ('standard_attr', )