Skip to contentSkip to conversation

oeqa/utils/qemurunner: get ip old fashioned way and use tcp serial console

PATCH New Stefan Stanacar 1 participant 1 message Aug 13, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 oeqa/utils/qemurunner: get ip old fashioned way and use tcp serial console

The way we read data from the serial console was unreliable and blocking (AutoBuilder seems to hit that often), so change the serial console type from unix socket to tcp and reverse the connection - don't let qemu act as server (wait for a connection). So now the serial console is used to save the boot log and make sure that we reached the login prompt. Until a better way is found this should solve some of the AutoBuilder failures (one being YB#4904).

Also we need to use the same method as the old qemuimagetest to get the ip (from the qemu process arguments), because that it's more reliable. The first version used here was to log into the target and use the output of "ip addr show eth0" but then systemd decides that it should rename interfaces, so that was changed to get the ip of the interface that has the default gw, but if there is no default gw we'll get the loopback ip and we end up trying to ssh into the host machine (some recent AutoBuilder runs showed that).

Changed in V2:
- use -ww for ps, as output might get truncated

---
 meta/lib/oeqa/utils/oeqemuconsole.py |  45 -------------
 meta/lib/oeqa/utils/qemurunner.py    | 123 +++++++++++++++++++++++------------
 2 files changed, 81 insertions(+), 87 deletions(-)
 delete mode 100644 meta/lib/oeqa/utils/oeqemuconsole.py
meta/lib/oeqa/utils/oeqemuconsole.py deleted +0 -45
deleted file mode 100644
index 95a2133..0000000
@@ -1,45 +0,0 @@
-import socket
-import time
-import re
-from telnetlib import Telnet
-
-class oeQemuConsole(Telnet):
-
-    """
-    Override Telnet class to use unix domain sockets,
-    Telnet uses AF_INET for socket, we don't want that.
-    Also, provide a read_all variant with timeout, that
-    returns whatever output there is.
-    """
-
-    def __init__(self, stream, logfile):
-
-        Telnet.__init__(self, host=None)
-        self.stream = stream
-        self.logfile = logfile
-        self.eof = 0
-        self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-        self.sock.connect(stream)
-
-    def log(self, msg):
-        if self.logfile:
-            with open(self.logfile, "a") as f:
-                f.write("%s\n" % msg)
-
-
-    def read_all_timeout(self, match, timeout=200):
-        """Read until EOF or until timeout or until match.
-        """
-        ret = False
-        self.process_rawq()
-        endtime = time.time() + timeout
-        while not self.eof and time.time() < endtime:
-            self.fill_rawq()
-            self.process_rawq()
-            if re.search(match, self.cookedq):
-                ret = True
-                break
-        buf = self.cookedq
-        self.cookedq = ''
-        self.log(buf)
-        return (ret, buf)
meta/lib/oeqa/utils/qemurunner.py +81 -42

199 lines not on this page · raw message

Signature · 1 line
1.8.3.1