]> code.ossystems Code Review - openembedded-core.git/commitdiff
qemurunner: Handle qemu start failure correctly
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 26 Sep 2015 16:49:25 +0000 (17:49 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 28 Sep 2015 10:58:19 +0000 (11:58 +0100)
If qemu didn't start correctly, we may not have registered the child
signal. This results in a nasty traceback which confuses the underlying
issue. Cleanup this code and make the handler cleanup conditional.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/qemurunner.py

index 0357f99d923f04bcdbd4fc39b799ff57f893820f..56249775616e7408f2c059263ecf1262ca8b3d46 100644 (file)
@@ -258,8 +258,9 @@ class QemuRunner:
 
     def stop(self):
         self.stop_thread()
-        if self.runqemu:
+        if hasattr(self, "origchldhandler"):
             signal.signal(signal.SIGCHLD, self.origchldhandler)
+        if self.runqemu:
             os.kill(self.monitorpid, signal.SIGKILL)
             logger.info("Sending SIGTERM to runqemu")
             try:
@@ -279,7 +280,6 @@ class QemuRunner:
             self.server_socket = None
         self.qemupid = None
         self.ip = None
-        signal.signal(signal.SIGCHLD, self.origchldhandler)
 
     def stop_thread(self):
         if self.thread and self.thread.is_alive():