Simplify the check for screendump termination thread event,
and also avoid a bug where we try to set a delay to a None
object.

Fixes the following bug that happens when running the
multi-disk test:

 Exception in thread Thread-1:
 Traceback (most recent call last):
   File "/usr/lib64/python2.7/threading.py", line 551, in
__bootstrap_inner
     self.run()
   File "/usr/lib64/python2.7/threading.py", line 504, in run
     self.__target(*self.__args, **self.__kwargs)
   File
"/home/lmr/Code/autotest.git/autotest/client/virt/virt_env_process.py",
line 549, in _take_screendumps
     _screendump_thread_termination_event.wait(delay)
 AttributeError: 'NoneType' object has no attribute 'wait'

Signed-off-by: Lucas Meneghel Rodrigues <l...@redhat.com>
---
 client/virt/virt_env_process.py |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py
index 816e0f7..4f9e19f 100644
--- a/client/virt/virt_env_process.py
+++ b/client/virt/virt_env_process.py
@@ -542,8 +542,9 @@ def _take_screendumps(test, params, env):
                 except NameError:
                     pass
             os.unlink(temp_filename)
-        if (_screendump_thread_termination_event is not None and
-            _screendump_thread_termination_event.isSet()):
-            _screendump_thread_termination_event = None
-            break
-        _screendump_thread_termination_event.wait(delay)
+
+        if _screendump_thread_termination_event is not None:
+            if _screendump_thread_termination_event.isSet():
+                _screendump_thread_termination_event = None
+                break
+            _screendump_thread_termination_event.wait(delay)
-- 
1.7.10.1

--
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