[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Reduce the time required to start xm-test domains by allowing the console



# HG changeset patch
# User danms@xxxxxxxxxx
# Node ID 4bdcb7f8c3d76dcdb7c67e996292fb3b2c8c483f
# Parent  1831da8249ba3aa234f3c36ffcb2ecb121ffbfc0
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.

diff -r 1831da8249ba -r 4bdcb7f8c3d7 tools/xm-test/lib/XmTestLib/Console.py
--- a/tools/xm-test/lib/XmTestLib/Console.py    Tue Nov 15 14:44:37 2005
+++ b/tools/xm-test/lib/XmTestLib/Console.py    Tue Nov 15 15:07:44 2005
@@ -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
diff -r 1831da8249ba -r 4bdcb7f8c3d7 tools/xm-test/lib/XmTestLib/XenDomain.py
--- a/tools/xm-test/lib/XmTestLib/XenDomain.py  Tue Nov 15 14:44:37 2005
+++ b/tools/xm-test/lib/XmTestLib/XenDomain.py  Tue Nov 15 15:07:44 2005
@@ -228,7 +228,7 @@
 #            status, output = traceCommand("xm list")
 
         XenDomain.start(self)
-        waitForBoot()
+#        waitForBoot()
 
     def startNow(self):
         XenDomain.start(self)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.