summaryrefslogtreecommitdiff
path: root/python/ovs
diff options
context:
space:
mode:
authorTerry Wilson <twilson@redhat.com>2021-09-02 15:34:14 +0000
committerIlya Maximets <i.maximets@ovn.org>2021-10-12 17:49:11 +0200
commit34fbdc41084c16f855efa9c56086b03644408b7d (patch)
tree9a737059e05061b68da211da090b9dcb269922f1 /python/ovs
parent803ed12e31b0377c37d7aa8c94b3b92f2081e349 (diff)
downloadopenvswitch-34fbdc41084c16f855efa9c56086b03644408b7d.tar.gz
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>
Diffstat (limited to 'python/ovs')
-rw-r--r--python/ovs/db/idl.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index ecae5e143..87ee06cde 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -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