Skip to contentSkip to conversation

qemurunner.py: wait for PID to appear in procfs

PATCH New Juro Bystricky 1 participant 1 message Sep 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemurunner.py: wait for PID to appear in procfs

We need QEMU PID in order to access "/proc/<qemupid>/cmdline" Having a valid QEMU PID does not mean we can access the proc entry immediately, we need to wait for the /proc/<qemupid> to appear before we can access it.

---
 meta/lib/oeqa/utils/qemurunner.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/lib/oeqa/utils/qemurunner.py +4 -3
index 9073315..427ae23 100644
@@ -394,9 +394,10 @@ class QemuRunner:
             f = open(self.qemu_pidfile, 'r')
             qemu_pid = f.read()
             f.close()
-            #logger.info("qemu_pid: %s" % qemu_pid)
-            self.qemupid = int(qemu_pid)
-            return True
+            qemupid = int(qemu_pid)
+            if os.path.exists("/proc/" + str(qemupid)):
+                self.qemupid = qemupid
+                return True
         return False
 
     def run_serial(self, command, raw=False, timeout=5):
Signature · 1 line
2.7.4