Since OVSDB commands execute in a different thread, the exceptions
that are passed to the original thread do not contain traceback
info from the exception. This patch stores the text from the
exception as it is caught so that the calling thread can log it.
Change-Id: If462c3d5dc104b349218dc910aa281220a5af528
def commit(self):
ovsdb_connection.queue_txn(self)
result = self.results.get()
- if isinstance(result, Exception) and self.check_error:
- raise result
+ if self.check_error:
+ if isinstance(result, idlutils.ExceptionResult):
+ if self.log_errors:
+ LOG.error(result.tb)
+ raise result.ex
return result
def do_commit(self):
import os
import Queue
import threading
+import traceback
from ovs.db import idl
from ovs import poller
try:
txn.results.put(txn.do_commit())
except Exception as ex:
- txn.results.put(ex)
+ er = idlutils.ExceptionResult(ex=ex,
+ tb=traceback.format_exc())
+ txn.results.put(er)
self.txns.task_done()
def queue_txn(self, txn):
from ovs import stream
+class ExceptionResult(object):
+ def __init__(self, ex, tb):
+ self.ex = ex
+ self.tb = tb
+
+
def get_schema_helper(connection):
err, strm = stream.Stream.open_block(
stream.Stream.open(connection))