summaryrefslogtreecommitdiff
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:48:41 +0200
commit2a963fc314df1dbf823d0b2692cc95d368cbdf4d (patch)
treeb73a9b451e46c676456b9a1e542ced9ab7fdf919
parent9efa2ea619e563f7ec70c93e4eefb4b96cdfd7d4 (diff)
downloadopenvswitch-2a963fc314df1dbf823d0b2692cc95d368cbdf4d.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>
-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 6cb5bef10..3ca47f96b 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -1479,6 +1479,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