diff mbox series

[ovs-dev,v2,5/7] python: idl: Handle "not allowed" transaction errors.

Message ID 20260922203106.2147404-6-twilson@redhat.com
State New
Delegated to: Ilya Maximets
Headers show
Series python: Backport C fixes that never made it. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_FreeBSD_Build_and_Test success github build: passed

Commit Message

Terry Wilson Sept. 22, 2026, 8:31 p.m. UTC
Port of C commit d6db7b3cc4bc ("ovsdb: add support for role-based access
controls").  Give "not allowed" its own case in the per-operation error
chain, matching ovsdb_idl_txn_process_reply().  It already fell into the
catch-all branch and was already a hard error, so this is for clarity and
to keep the chain aligned with C, which deliberately does not log a
warning for it.

Log a warning for any other unrecognized (non-"aborted") per-operation
error, as C does.  Such errors were already recorded on the transaction
by __set_error_json() and already counted as hard errors; the warning is
the only new behavior.

Assisted-by: Claude Opus 4.8
Signed-off-by: Terry Wilson <twilson@redhat.com>
---
 python/ovs/db/idl.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index dafeaff26..5de8a1dea 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -2270,11 +2270,14 @@  class Transaction(object):
                             soft_errors = True
                         elif error == "not owner":
                             lock_errors = True
-                        elif error == "aborted":
-                            pass
-                        else:
+                        elif error == "not allowed":
+                            hard_errors = True
+                            self.__set_error_json(op)
+                        elif error != "aborted":
                             hard_errors = True
                             self.__set_error_json(op)
+                            # XXX rate-limit
+                            vlog.warn("transaction error: %s" % self._error)
                 else:
                     hard_errors = True
                     self.__set_error_json(op)