Backend: always operate on (class level) ovsdb_connection

Before the patch, the code was always attempting to rebuild indices and
start a connection, even if a connection was already started and cached
in .ovsdb_connection class attribute.

(Both operations were gracefully handled as no-ops. But they left some
confusing log messages about indices rebuild etc.)

Change-Id: Ib9ef29da251f5d184fa6abd20e1b17010f2ed1a1
This commit is contained in:
Ihar Hrachyshka 2024-05-10 18:39:39 -04:00
parent 1cb9acc015
commit 33621ab1a8
1 changed files with 2 additions and 2 deletions

View File

@ -32,12 +32,12 @@ class Backend(object):
super().__init__(**kwargs)
self.ovsdb_connection = connection
if auto_index:
if connection.is_running:
if self.ovsdb_connection.is_running:
LOG.debug("Connection already started, not creating indices")
else:
self.autocreate_indices()
if start:
self.start_connection(connection)
self.start_connection(self.ovsdb_connection)
@property
def ovsdb_connection(self):