Don't directly access the in-memory DB for NB_Global row
Directly accessing the in-memory OVSDB via 'tables' outside of a Command object isn't safe. For example, if we lose connection to the OVSDB and reconnect, the in-memory copy will be replaced by the Connection thread. If we get a call to get_agents() that is handled by the main thread and we look up the value from there, the value we expect may be missing. The dependent patch in ovsdbapp adds some locking to help with this some API commands like lookup() that are heavily used and with ReadOnlyCommands which also aren't processed like normal Command objects inside the connection thread. There will be many more changes in the ml2/ovn code similar to this one, as we directly access the in-memory copy a lot. Depends-On: https://review.opendev.org/#/c/745746/ Change-Id: I328391c88af1ef2f6b1af3787c63d8591fb317b5 Closes-Bug: #1888878
This commit is contained in:
parent
be1e4f845d
commit
e1582e39a1
|
@ -166,7 +166,8 @@ class OvsdbNbOvnIdl(nb_impl_idl.OvnNbApiIdlImpl, Backend):
|
|||
|
||||
@property
|
||||
def nb_global(self):
|
||||
return next(iter(self.tables['NB_Global'].rows.values()))
|
||||
return next(iter(self.db_list_rows('NB_Global').execute(
|
||||
check_error=True)))
|
||||
|
||||
def create_transaction(self, check_error=False, log_errors=True,
|
||||
bump_nb_cfg=False):
|
||||
|
|
Loading…
Reference in New Issue