ia64/xen-unstable

changeset 7825:4bdcb7f8c3d7

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.
author danms@us.ibm.com
date Tue Nov 15 16:07:44 2005 +0100 (2005-11-15)
parents 1831da8249ba
children bb0e5f7f94fd
files tools/xm-test/lib/XmTestLib/Console.py tools/xm-test/lib/XmTestLib/XenDomain.py
line diff
     1.1 --- a/tools/xm-test/lib/XmTestLib/Console.py	Tue Nov 15 15:44:37 2005 +0100
     1.2 +++ b/tools/xm-test/lib/XmTestLib/Console.py	Tue Nov 15 16:07:44 2005 +0100
     1.3 @@ -62,26 +62,37 @@ class XmConsole:
     1.4          self.historySaveCmds  = historySaveCmds
     1.5          self.debugMe          = False
     1.6          self.limit            = None
     1.7 +        self.delay            = 2
     1.8  
     1.9          consoleCmd = ["/usr/sbin/xm", "xm", "console", domain]
    1.10  
    1.11 -        if verbose:
    1.12 -            print "Console executing: " + str(consoleCmd)
    1.13 +        start = time.time()
    1.14 +
    1.15 +        while (time.time() - start) < self.TIMEOUT:
    1.16 +            if verbose:
    1.17 +                print "Console executing: %s" % str(consoleCmd)
    1.18  
    1.19 -        pid, fd = pty.fork()
    1.20 +            pid, fd = pty.fork()
    1.21  
    1.22 -        if pid == 0:
    1.23 -            os.execvp("/usr/sbin/xm", consoleCmd[1:])
    1.24 +            if pid == 0:
    1.25 +                os.execvp("/usr/sbin/xm", consoleCmd[1:])
    1.26 +
    1.27 +            self.consolePid = pid
    1.28 +            self.consoleFd  = fd
    1.29  
    1.30 -        self.consolePid = pid
    1.31 -        self.consoleFd  = fd
    1.32 -
    1.33 -        tty.setraw(self.consoleFd, termios.TCSANOW)
    1.34 +            tty.setraw(self.consoleFd, termios.TCSANOW)
    1.35              
    1.36 -        bytes = self.__chewall(self.consoleFd)
    1.37 -        if bytes < 0:
    1.38 -            raise ConsoleError("Console didn't respond")
    1.39 +            bytes = self.__chewall(self.consoleFd)
    1.40 +
    1.41 +            if bytes > 0:
    1.42 +                return
    1.43  
    1.44 +            if verbose:
    1.45 +                print "Console didn't attach, waiting %i sec..." % self.delay
    1.46 +            time.sleep(self.delay)
    1.47 +
    1.48 +        raise ConsoleError("Console didn't respond after %i secs" % self.TIMEOUT)
    1.49 +    
    1.50      def __addToHistory(self, line):
    1.51          self.historyBuffer.append(line)
    1.52          self.historyLines += 1
     2.1 --- a/tools/xm-test/lib/XmTestLib/XenDomain.py	Tue Nov 15 15:44:37 2005 +0100
     2.2 +++ b/tools/xm-test/lib/XmTestLib/XenDomain.py	Tue Nov 15 16:07:44 2005 +0100
     2.3 @@ -228,7 +228,7 @@ class XmTestDomain(XenDomain):
     2.4  #            status, output = traceCommand("xm list")
     2.5  
     2.6          XenDomain.start(self)
     2.7 -        waitForBoot()
     2.8 +#        waitForBoot()
     2.9  
    2.10      def startNow(self):
    2.11          XenDomain.start(self)