qemu doesn't always behave well and can hang too.
Log calls to stop qemu and finally kill it with force
if was still alive.

Signed-off-by: Mikko Rapeli <[email protected]>
---
 meta/lib/oeqa/utils/qemurunner.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/lib/oeqa/utils/qemurunner.py 
b/meta/lib/oeqa/utils/qemurunner.py
index 7f5d87fe70..494b4e03da 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -590,12 +590,21 @@ class QemuRunner:
             self.monitorpipe.close()
 
     def stop_qemu_system(self):
+        self.logger.debug('stop_qemu_system: self.qemupid = %s' % 
(self.qemupid))
         if self.qemupid:
             try:
                 # qemu-system behaves well and a SIGTERM is enough
+                self.logger.debug('sending SIGTERM to %s' % (self.qemupid))
                 os.kill(self.qemupid, signal.SIGTERM)
             except ProcessLookupError as e:
                 self.logger.warning('qemu-system ended unexpectedly')
+            time.sleep(5)
+            try:
+                # qemu-system did not behave well
+                self.logger.debug('sending SIGKILL to %s' % (self.qemupid))
+                os.kill(self.qemupid, signal.SIGKILL)
+            except ProcessLookupError as e:
+                self.logger.debug('qemu-system already dead')
 
     def stop_thread(self):
         if self.thread and self.thread.is_alive():
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176203): 
https://lists.openembedded.org/g/openembedded-core/message/176203
Mute This Topic: https://lists.openembedded.org/mt/96401367/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to