Be sure to kill qemu-system on testimage
cover Be sure to kill qemu-system on testimage
From: Mariano Lopez <[email protected]>
With refactor of runqemu to use python instead of shel scripting, the qemu-system process keeps running if runqemu fails. This series will fix this and will terminate qemu-system explicity.
The following changes since commit 81021bc0aa0f64e67535f6a9551e921a64fe4395:
yocto-project-qs, ref-manual: Added note for "resources temporarily unavailable" error (2017-01-11 17:23:18 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib mariano/qemu_fix
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=mariano/qemu_fix
Mariano Lopez (2):
oeqa/utils/qemurunner.py: Add missing sys module oeqa/utils/qemurunner.py: Be sure to stop qemu-system
meta/classes/testimage.bbclass | 2 ++ meta/lib/oeqa/utils/qemurunner.py | 10 ++++++++++ 2 files changed, 12 insertions(+)
Signature · 1 line
2.6.6
PATCH 1/2 oeqa/utils/qemurunner.py: Add missing sys module
From: Mariano Lopez <[email protected]>
This adds the missing sys module used by the child process to exit. It seems the exception was cached in testimage and selftest. It seems nobody noticed this because the module is only used for sys.exit().
--- meta/lib/oeqa/utils/qemurunner.py | 1 + 1 file changed, 1 insertion(+)
meta/lib/oeqa/utils/qemurunner.py +1 -0
@@ -7,6 +7,7 @@ import subprocess import os +import sys import time import signal import re
Signature · 1 line
2.6.6
PATCH 2/2 oeqa/utils/qemurunner.py: Be sure to stop qemu-system
In reply to [email protected]From: Mariano Lopez <[email protected]>
When runqemu fails, qemu-system process would keep running and won't be killed, setpgrp() was used when runqemu was a shell script but it seems it doesn't work always with python.
This would kill qemu-system explicity and to avoid leaving it behind.
--- meta/classes/testimage.bbclass | 2 ++ meta/lib/oeqa/utils/qemurunner.py | 9 +++++++++ 2 files changed, 11 insertions(+)
meta/classes/testimage.bbclass +2 -0
@@ -171,6 +171,8 @@ def testimage_main(d): bb.plain(msg) else: bb.fatal("%s - FAILED - check the task log and the ssh log" % pn) + except BlockingIOError as err: + bb.error('runqemu failed, shutting down...') finally: signal.signal(signal.SIGTERM, tc.origsigtermhandler) target.stop()
meta/lib/oeqa/utils/qemurunner.py +9 -0
@@ -296,6 +296,7 @@ class QemuRunner: def stop(self): self.stop_thread() + self.stop_qemu_system() if hasattr(self, "origchldhandler"): signal.signal(signal.SIGCHLD, self.origchldhandler) if self.runqemu:
@@ -320,6 +321,14 @@ class QemuRunner: self.qemupid = None self.ip = None + def stop_qemu_system(self): + if self.qemupid: + try: + # qemu-system behaves well and a SIGTERM is enough + os.kill(self.qemupid, signal.SIGTERM) + except ProcessLookupError as e: + logger.warn('qemu-system ended unexpectedly') + def stop_thread(self): if self.thread and self.thread.is_alive(): self.thread.stop()
Signature · 1 line
2.6.6