Ordinarily the IDL finds out in advance whether a particular database is
on its server, or it finds out via notifications. But it's also a good
idea to adopt a belt-and-suspenders approach so that, if the IDL does
receive an "unknown database" error, we treat it as a "soft" error that
can be fixed by reconnecting to another server, rather than a "hard"
error that should cause an immediate abort.
This is a Python port of C commit e83ea0d652f2 ("ovsdb-idl: Treat
"unknown database" error as reason to reconnect."). It relies on
Idl.flag_inconsistency() to force the reconnect and full re-download.
Assisted-by: Claude Opus 4.8 <[email protected]>
Signed-off-by: Terry Wilson <[email protected]>
---
python/ovs/db/idl.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 0a7478e9f..07068407d 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -2260,6 +2260,13 @@ class Transaction(object):
if error is not None:
if error == "timed out":
soft_errors = True
+ elif error == "unknown database":
+ # ovsdb-server uses this error message to
+ # indicate that the database in question was
+ # removed, converted, etc. Flag the IDL as
+ # inconsistent so it reconnects and resyncs.
+ self.idl.flag_inconsistency()
+ soft_errors = True
elif error == "not owner":
lock_errors = True
elif error == "aborted":
--
2.49.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev