Skip to contentSkip to conversation

[PATCH][XM-TEST]

PATCH Applied Dan Smith 2 participants 2 messages Nov 15, 2005

lore
Share & tools
lore

Dan Smith

author
#0 lore raw

PATCH 1/1 [PATCH][XM-TEST]

This patch makes xm-test run in 45 minutes, as opposed to 100 minutes on my machine. I left the waitForBoot() line commented out so that it can easily be re-enabled if a slower machine needs it, although I hope not.

# HG changeset patch
# User [email protected]
# Node ID 50e47ac8c475b8d062db55457419ea563307a86f
# Parent 995e94c4802e5c0376b0483f3b2473a8f7d7808e
Reduce the time required to start xm-test domains by allowing the console to retry connecting to the DomU multiple times. A polling approach instead of a wait-and-hope-it-works approach.

tools/xm-test/lib/XmTestLib/Console.py +27 -16
diff -r 995e94c4802e -r 50e47ac8c475 tools/xm-test/lib/XmTestLib/Console.py
@@ -62,26 +62,37 @@
         self.historySaveCmds  = historySaveCmds
         self.debugMe          = False
         self.limit            = None
+        self.delay            = 2
 
         consoleCmd = ["/usr/sbin/xm", "xm", "console", domain]
 
-        if verbose:
-            print "Console executing: " + str(consoleCmd)
-
-        pid, fd = pty.fork()
-
-        if pid == 0:
-            os.execvp("/usr/sbin/xm", consoleCmd[1:])
-
-        self.consolePid = pid
-        self.consoleFd  = fd
-
-        tty.setraw(self.consoleFd, termios.TCSANOW)
+        start = time.time()
+
+        while (time.time() - start) < self.TIMEOUT:
+            if verbose:
+                print "Console executing: %s" % str(consoleCmd)
+
+            pid, fd = pty.fork()
+
+            if pid == 0:
+                os.execvp("/usr/sbin/xm", consoleCmd[1:])
+
+            self.consolePid = pid
+            self.consoleFd  = fd
+
+            tty.setraw(self.consoleFd, termios.TCSANOW)
             
-        bytes = self.__chewall(self.consoleFd)
-        if bytes < 0:
-            raise ConsoleError("Console didn't respond")
-
+            bytes = self.__chewall(self.consoleFd)
+
+            if bytes > 0:
+                return
+
+            if verbose:
+                print "Console didn't attach, waiting %i sec..." % self.delay
+            time.sleep(self.delay)
+
+        raise ConsoleError("Console didn't respond after %i secs" % self.TIMEOUT)
+    
     def __addToHistory(self, line):
         self.historyBuffer.append(line)
         self.historyLines += 1
tools/xm-test/lib/XmTestLib/XenDomain.py +1 -1
diff -r 995e94c4802e -r 50e47ac8c475 tools/xm-test/lib/XmTestLib/XenDomain.py
@@ -228,7 +228,7 @@
 #            status, output = traceCommand("xm list")
 
         XenDomain.start(self)
-        waitForBoot()
+#        waitForBoot()
 
     def startNow(self):
         XenDomain.start(self)
Signature · 4 lines
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: [email protected]

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Applied
#1 lore raw
Quoted 6 lines · Dan Smith

This patch makes xm-test run in 45 minutes, as opposed to 100 minutes on my machine. I left the waitForBoot() line commented out so that it can easily be re-enabled if a slower machine needs it, although I hope not.

Applied, thank you.

Ewan.