Because contexts are thread specific, exceptions raised in another thread will
not contain the context in which the thread was started/joined.  This context
should be explicitly inserted into any exception raised in the thread and
re-raised in join().

Signed-off-by: Michael Goldish <mgold...@redhat.com>
---
 client/tests/kvm/kvm_utils.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index 646d4fa..6cfed3f 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -1179,6 +1179,11 @@ class Thread(threading.Thread):
         threading.Thread.join(self, timeout)
         try:
             if self._e:
+                # Because the exception was raised in another thread, we need
+                # to explicitly insert the current context into it
+                s = error.exception_context(self._e[1])
+                s = error.join_contexts(error.get_context(), s)
+                error.set_exception_context(self._e[1], s)
                 raise self._e[0], self._e[1], self._e[2]
             else:
                 return self._retval
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to