Port of C commit 1b1d2e6daa56 ("ovsdb: Introduce experimental support for
clustered databases"). A top-level JSON-RPC error reply of "canceled"
means ovsdb-server aborted the transaction because the database in
question was removed, converted, etc.; treat it as TRY_AGAIN rather than a
hard error. For any other top-level error, and for a reply that is not a
JSON array, record the offending JSON on the transaction so the client can
inspect it.
Assisted-by: Claude Opus 4.8 <[email protected]>
Signed-off-by: Terry Wilson <[email protected]>
---
python/ovs/db/idl.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 30bc6cb44..15d7ce732 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -2239,10 +2239,19 @@ class Transaction(object):
def _process_reply(self, msg):
if msg.type == ovs.jsonrpc.Message.T_ERROR:
- self._status = Transaction.ERROR
+ if msg.error == "canceled":
+ # ovsdb-server uses this error message to indicate that the
+ # transaction was canceled because the database in question was
+ # removed, converted, etc.
+ self._status = Transaction.TRY_AGAIN
+ else:
+ self._status = Transaction.ERROR
+ self.__set_error_json(msg.error)
elif not isinstance(msg.result, (list, tuple)):
# XXX rate-limit
vlog.warn('reply to "transact" is not JSON array')
+ self._status = Transaction.ERROR
+ self.__set_error_json(msg.result)
else:
hard_errors = False
soft_errors = False
--
2.49.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev