2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-19 14:37:21 +00:00

python: idl: Avoid sending transactions when the DB is not synced up.

This ports the C IDL change f50714b to the Python IDL:

Until now the code here would happily try to send transactions to the
database server even if the database connection was not in the correct
state.  In some cases this could lead to strange behavior, such as sending
a database transaction for a database that the IDL had just learned did not
exist on the server.

Signed-off-by: Terry Wilson <twilson@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Terry Wilson
2021-09-02 15:34:14 +00:00
committed by Ilya Maximets
parent 803ed12e31
commit 34fbdc4108

View File

@@ -1505,6 +1505,11 @@ class Transaction(object):
if self != self.idl.txn:
return self._status
if self.idl.state != Idl.IDL_S_MONITORING:
self._status = Transaction.TRY_AGAIN
self.__disassemble()
return self._status
# If we need a lock but don't have it, give up quickly.
if self.idl.lock_name and not self.idl.has_lock:
self._status = Transaction.NOT_LOCKED