Skip to contentSkip to conversation

New Network Infrastructure for Xm-Test

PATCH New Daniel Stekloff 1 participant 1 message Apr 24, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 New Network Infrastructure for Xm-Test

This patch changes how consoles are used in xm-test in the library. It moves consoles to being tied directly to the XenDomains they are for. Instead of creating and closing a console separately, this patch makes opening and closing the console methods in XenDomain.

This patch is needed for the new network infrastructure because when domains are created with devices there are console commands that need to be run. For networking, ifconfig has to be run on the new domain once it's started to configure and activate the interface.

All comments welcome.

Thanks,

Dan

# HG changeset patch
# User [email protected] # Node ID 45aaca4aed38771243e32414cc6964f306751bda # Parent 5562ee51bb7506266dc6d422af028a9e566d5305

Second step toward a new network infrastructure, move XmConsole to be in XenDomain. The devices we will add, like network, will need to run console commands when a domain is started. So I have made console be a part of domain object, which it's tied to anyway.

tools/xm-test/lib/XmTestLib/Console.py +12 -5
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/lib/XmTestLib/Console.py
@@ -234,11 +234,14 @@
             "return": 0,
             }
 
-    def closeConsole(self):
+    def __closeConsole(self):
         """Closes the console connection and ensures that the console
-        process is killed"""
-        os.close(self.consoleFd)
-        os.kill(self.consolePid, 2)
+        process is killed. This should only be called by the domain.
+        Tests should call domain.closeConsole()"""
+        if self.consolePid != 0:
+            os.close(self.consoleFd)
+            os.kill(self.consolePid, 2)
+            self.consolePid = 0
 
 
     def setLimit(self, limit):
@@ -249,6 +252,10 @@
             self.limit = int(limit)
         except Exception, e:
             self.limit = None
+ 
+    def setHistorySaveCmds(self, value):
+        # True or False
+        self.historySaveCmds = value
             
                    
 if __name__ == "__main__":
@@ -272,7 +279,7 @@
         print "Console failed (%)" % str(e)
         sys.exit(255)
         
-    t.closeConsole()
+    t._XmConsole__closeConsole()
     
     print run["output"],
     sys.exit(run["return"])
tools/xm-test/lib/XmTestLib/Test.py +1 -2
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/lib/XmTestLib/Test.py
@@ -173,8 +173,7 @@
     domain = XmTestDomain()
 
     try:
-        domain.start()
-        console = XmConsole(domain.getName())
+        console = domain.start()
         console.runCmd("ls")
     except DomainError, e:
         return True
tools/xm-test/lib/XmTestLib/XenDomain.py +37 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/lib/XmTestLib/XenDomain.py
@@ -27,6 +27,7 @@
 from Xm import *
 from Test import *
 from config import *
+from Console import *
 
 BLOCK_ROOT_DEV = "hda"
 
@@ -193,6 +194,8 @@
             self.name = getUniqueName()
 
         self.config = config
+        self.console = None
+
         # Set domain type, either PV for ParaVirt domU or HVM for 
         # FullVirt domain
         if ENABLE_HVM_SUPPORT:
@@ -200,7 +203,7 @@
         else:
             self.type = "PV"
 
-    def start(self):
+    def start(self, noConsole=False):
 
         ret, output = traceCommand("xm create %s" % self.config)
 
@@ -213,10 +216,22 @@
         if self.getDomainType() == "HVM":
             waitForBoot()
 
+        if self.console and noConsole == True:
+            self.closeConsole()
+
+        elif self.console and noConsole == False:
+            return self.console
+
+        elif not self.console and noConsole == False:
+            return self.getConsole()
+
     def stop(self):
         prog = "xm"
         cmd = " shutdown "
 
+        if self.console:
+            self.closeConsole()
+
         ret, output = traceCommand(prog + cmd + self.config.getOpt("name"))
 
         return ret
@@ -225,6 +240,9 @@
         prog = "xm"
         cmd = " destroy "
 
+        if self.console:
+            self.closeConsole()
+
         ret, output = traceCommand(prog + cmd + self.config.getOpt("name"))
 
         return ret
@@ -237,6 +255,24 @@
 
     def getDomainType(self):
         return self.type
+
+    def closeConsole(self):
+        # The domain closeConsole command must be called by tests, not the
+        # console's close command. Once close is called, the console is
+        # gone. You can't get history or anything else from it.
+        if self.console:
+            self.console._XmConsole__closeConsole()
+            self.console = None
+
+    def getConsole(self):
+        if self.console:
+            self.closeConsole()
+
+        self.console = XmConsole(self.getName())
+        # Activate the console
+        self.console.sendInput("input")
+
+        return self.console
 
 
 class XmTestDomain(XenDomain):
tools/xm-test/tests/_sanity/01_domu_proc.py +1 -3
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/_sanity/01_domu_proc.py
@@ -15,13 +15,11 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     FAIL(str(e))
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("foo")
     run = console.runCmd("cat /proc/cpuinfo")
 except ConsoleError, e:
     FAIL(str(e))
tools/xm-test/tests/block-create/01_block_attach_device_pos.py +3 -9
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-create/01_block_attach_device_pos.py
@@ -16,7 +16,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
@@ -25,13 +25,7 @@
 
 # Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -49,7 +43,7 @@
 	FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/block-create/02_block_attach_file_device_pos.py +4 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-create/02_block_attach_file_device_pos.py
@@ -16,22 +16,16 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
+# Set console to save commands and make sure we can run cmds
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -49,7 +43,7 @@
         FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py +3 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py
@@ -16,22 +16,15 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -49,7 +42,7 @@
             FAIL("Device is not actually attached to domU")
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_pos.py +3 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_pos.py
@@ -16,22 +16,15 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -57,7 +50,7 @@
 		FAIL("Failed to dettach block device: /proc/partitions still showing that!")
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py +3 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py
@@ -16,22 +16,15 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -53,7 +46,7 @@
 	FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py +3 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py
@@ -16,22 +16,15 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -52,7 +45,7 @@
 	FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py +3 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py
@@ -16,22 +16,15 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -72,7 +65,7 @@
 		FAIL("Failed to dettach block device: /proc/partitions still showing that!")
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/block-create/10_block_attach_dettach_multiple_devices.py +3 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-create/10_block_attach_dettach_multiple_devices.py
@@ -53,22 +53,15 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -103,7 +96,7 @@
 	    FAIL(msg)
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py +3 -4
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py
@@ -12,15 +12,14 @@
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
     FAIL("Unable to create domain")
 
 try:
-    console  = XmConsole(domain.getName(), historySaveCmds=True)
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     run = console.runCmd("cat /proc/partitions | grep hda1")
     run2 = console.runCmd("cat /proc/partitions")
 except ConsoleError, e:
@@ -41,7 +40,7 @@
     saveLog(console.getHistory())
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 domain.stop()
 
 if run["return"] == 0:
tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py +3 -9
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py
@@ -11,7 +11,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -23,12 +23,6 @@
     pass
 
 try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1")
 except ConsoleError, e:
     saveLog(console.getHistory())
@@ -47,7 +41,7 @@
     saveLog(console.getHistory())
     FAIL(str(e))
 
+domain.stop()
+
 if run["return"] == 0:
     FAIL("block-detach failed to detach block device")
-    
-    
tools/xm-test/tests/block-destroy/04_block-destroy_nonattached_neg.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-destroy/04_block-destroy_nonattached_neg.py
@@ -13,7 +13,7 @@
 domain = XmTestDomain()
                                                                                                        
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print e.extra
tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py +2 -4
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py
@@ -12,15 +12,13 @@
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
     FAIL("Unable to create domain")
 
 try:
-    console  = XmConsole(domain.getName(), historySaveCmds=True)
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1")
     run2 = console.runCmd("cat /proc/partitions")
 except ConsoleError, e:
@@ -41,7 +39,7 @@
     saveLog(console.getHistory())
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 domain.stop()
 
 if run["return"] == 0:
tools/xm-test/tests/block-list/01_block-list_pos.py +3 -7
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-list/01_block-list_pos.py
@@ -15,7 +15,7 @@
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -31,16 +31,12 @@
 
 #Verify the block device on DomainU
 try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1")
 except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
+domain.stop()
+
 if run["return"] != 0:
     FAIL("Failed to verify that block dev is attached on DomainU")
tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py +3 -7
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py
@@ -14,7 +14,7 @@
 domain = XmTestDomain()
                                                                                               
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -36,16 +36,12 @@
 
 #Verify attached block device on DomainU
 try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1")
 except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
+domain.stop()
+
 if run["return"] != 0:
     FAIL("Failed to verify that block dev is attached on DomainU")
tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py +3 -7
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py
@@ -15,7 +15,7 @@
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -43,16 +43,12 @@
 
 #Verify attached block device on DomainU
 try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1;cat /proc/partitions | grep hda2")
 except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
+domain.stop()
+
 if run["return"] != 0:
     FAIL("Failed to verify that block dev is attached on DomainU")
tools/xm-test/tests/block-list/04_block-list_nodb_pos.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-list/04_block-list_nodb_pos.py
@@ -14,7 +14,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print e.extra
tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py +2 -7
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py
@@ -11,13 +11,8 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
-    FAIL(str(e))
-
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
     FAIL(str(e))
 
 s, o = traceCommand("xm block-list %s" % domain.getName())
@@ -72,4 +67,4 @@
 if o:
     FAIL("block-list still shows something after all devices detached!")
     
-
+domain.stop()
tools/xm-test/tests/create/01_create_basic_pos.py +5 -13
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/01_create_basic_pos.py
@@ -18,36 +18,28 @@
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
+
+# Save a transcript for human review
+saveLog(console.getHistory())
     
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
-
-# Save a transcript for human review
-saveLog(console.getHistory())
 
 # Check the output of 'ls'
 
tools/xm-test/tests/create/04_create_conflictname_neg.py +2 -2
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/04_create_conflictname_neg.py
@@ -17,7 +17,7 @@
 
 #start it
 try:
-    domain1.start()
+    domain1.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain1 because:"
@@ -30,7 +30,7 @@
 #start it
 eyecatcher = "Pass"
 try:
-    domain2.start()
+    domain2.start(noConsole=True)
 except DomainError, e:
     eyecatcher = "Fail"
     # Stop the domain1 (nice shutdown)
tools/xm-test/tests/create/06_create_mem_neg.py +2 -2
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/06_create_mem_neg.py
@@ -23,7 +23,7 @@
 domain1=XmTestDomain(extraConfig=config1)
 
 try:
-    domain1.start()
+    domain1.start(noConsole=True)
     eyecatcher1 = "Created"
 except DomainError, e:
     eyecatcher1 = "Fail"
@@ -42,7 +42,7 @@
 domain2=XmTestDomain(extraConfig=config2)
 
 try:
-    domain2.start()
+    domain2.start(noConsole=True)
     eyecatcher2 = "Created"
 except DomainError, e:
     eyecatcher2 = "Fail"
tools/xm-test/tests/create/07_create_mem64_pos.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/07_create_mem64_pos.py
@@ -28,7 +28,7 @@
 
 #start it
 try:
-    domain_mem64.start()
+    domain_mem64.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain_mem64 because:"
tools/xm-test/tests/create/08_create_mem128_pos.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/08_create_mem128_pos.py
@@ -28,7 +28,7 @@
 
 #start it
 try:
-    domain_mem128.start()
+    domain_mem128.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain_mem128 because:"
tools/xm-test/tests/create/09_create_mem256_pos.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/09_create_mem256_pos.py
@@ -28,7 +28,7 @@
 
 #start it
 try:
-    domain_mem256.start()
+    domain_mem256.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain_mem256 because:"
tools/xm-test/tests/create/10_create_fastdestroy.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/10_create_fastdestroy.py
@@ -28,7 +28,7 @@
 for i in range(0,50):
     domain = XmTestDomain("testdomain")
     try:
-        domain.start()
+        domain.start(noConsole=True)
     except DomainError,e:
         print "Failed: " + e.extra
         NSPerror = check_for_NSP_error(e.extra)
tools/xm-test/tests/create/11_create_concurrent_pos.py +1 -3
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/11_create_concurrent_pos.py
@@ -43,15 +43,13 @@
                        extraConfig={"memory":MEM_PER_DOM})
 
     try:
-        dom.start()
+        cons = dom.start()
     except DomainError, e:
         if verbose:
             print str(e)
         FAIL("[%i] Failed to create domain" % d)
 
     try:
-        cons = XmConsole(dom.getName())
-        cons.sendInput("foo")
         cons.runCmd("ls")
     except ConsoleError, e:
         FAIL("[%i] Failed to attach console to %s" % (d, dom.getName()))
tools/xm-test/tests/create/12_create_concurrent_stress_pos.py +1 -8
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/12_create_concurrent_stress_pos.py
@@ -17,17 +17,11 @@
     dom = XmTestDomain(extraConfig={"memory" : MEM})
 
     try:
-        dom.start()
+        cons = dom.start()
     except DomainError, e:
         if verbose:
             print str(e)
         FAIL("Failed to start %s" % dom.getName())
-
-    try:
-        cons = XmConsole(dom.getName())
-        cons.sendInput("foo")
-    except ConsoleError, e:
-        FAIL(str(e))
 
     if verbose:
         print "[%i/%i] Started %s" % (i, DOMS, dom.getName())
@@ -56,4 +50,3 @@
     if run["return"] != 0:
         FAIL("Domain %s didn't survive!" % d.getName())
 
-        
tools/xm-test/tests/create/13_create_multinic_pos.py +1 -3
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/13_create_multinic_pos.py
@@ -18,13 +18,11 @@
     domain = XmTestDomain(extraConfig=config)
 
     try:
-        domain.start()
+        console = domain.start()
     except DomainError, e:
         FAIL("(%i nics) " % i + str(e))
 
     try:
-        console = XmConsole(domain.getName())
-        console.sendInput("input")
         console.runCmd("ls")
     except ConsoleError, e:
         FAIL("(%i nics) Console didn't respond: probably crashed!" % i)
tools/xm-test/tests/create/14_create_blockroot_pos.py +1 -7
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/14_create_blockroot_pos.py
@@ -31,20 +31,14 @@
     domain = XenDomain(name=domConfig.getOpt("name"), config=domConfig)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
       FAIL(str(e))
 
 #waitForBoot()
 
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
 #    console.debugMe = True
-    console.sendInput("foo")
     run = console.runCmd("ls")
 
 except ConsoleError, e:
tools/xm-test/tests/create/15_create_smallmem_pos.py +1 -3
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/15_create_smallmem_pos.py
@@ -12,13 +12,11 @@
                                    "extra" :"mem=%iM" % MEM})
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     FAIL("Unable to start a domain with %i MB" % MEM)
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
     console.runCmd("ls")
 except ConsoleError, e:
     if e.reason == RUNAWAY:
tools/xm-test/tests/create/16_create_smallmem_neg.py +1 -3
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/create/16_create_smallmem_neg.py
@@ -13,13 +13,11 @@
                                    "extra" :"mem=%iM" % MEM})
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     FAIL("Unable to start a domain with %i MB" % MEM)
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
     console.runCmd("ls")
 except ConsoleError, e:
     if e.reason == RUNAWAY:
tools/xm-test/tests/destroy/01_destroy_basic_pos.py +2 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/destroy/01_destroy_basic_pos.py
@@ -14,29 +14,21 @@
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("foo")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Check the output of 'ls'
 if not re.search("proc", run["output"]):
tools/xm-test/tests/destroy/05_destroy_byid_pos.py +2 -3
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/destroy/05_destroy_byid_pos.py
@@ -7,8 +7,7 @@
 # Positive Test:
 # Test Description:
 # 1. Create a domain
-# 2. Attach a console to the domain. 
-# 3. Destroy the domain by id
+# 2. Destroy the domain by id
  
 import sys
 import re
@@ -21,7 +20,7 @@
 
 # Start it
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/destroy/07_destroy_stale_pos.py +1 -4
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/destroy/07_destroy_stale_pos.py
@@ -108,14 +108,11 @@
         # Create a domain
 
         try:
-            domain.start()
+            console = domain.start()
         except DomainError, e:
             FAIL(str(e))
 
-        # Attach a console and make sure it's live
         try:
-            console = XmConsole(domain.getName())
-            console.sendInput("foo")
             console.runCmd("ls")
         except ConsoleError, e:
             FAIL(str(e))
tools/xm-test/tests/list/04_list_goodparm_pos.py +2 -8
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/list/04_list_goodparm_pos.py
@@ -12,23 +12,17 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-
 status, output = traceCommand("xm list %s" % domain.getName())
 
 if status != 0:
     FAIL("`xm list %s' failed with invalid status %i != 0" % (domain.getName(), status))
 
-console.closeConsole()
+domain.closeConsole()
 domain.stop()
tools/xm-test/tests/memset/01_memset_basic_pos.py +2 -5
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/memset/01_memset_basic_pos.py
@@ -28,17 +28,14 @@
 
 # Start it
 try:
-    domain.start() 
+    console = domain.start() 
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName()) 
-    console.sendInput("input") 
     # Make sure it's up an running before we continue
     console.runCmd("ls")
 except ConsoleError, e:
@@ -84,7 +81,7 @@
 
 # quiesce everything
 # Close the console
-console.closeConsole() 
+domain.closeConsole() 
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/memset/03_memset_random_pos.py +1 -7
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/memset/03_memset_random_pos.py
@@ -14,7 +14,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to start domain:"
@@ -24,12 +24,6 @@
 times = random.randint(10,50)
 origmem = domain.config.getOpt("memory")
 currmem = domain.config.getOpt("memory")
-
-try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
-except ConsoleError, e:
-    FAIL(str(e))
 
 for i in range(0,times):
     amt = random.randint(-10,10)
tools/xm-test/tests/memset/04_memset_smallmem_pos.py +1 -3
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/memset/04_memset_smallmem_pos.py
@@ -11,7 +11,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to start domain: "
@@ -19,8 +19,6 @@
     FAIL(str(e))
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
     # Make sure it's alive before we proceed
     console.runCmd("ls")
 except ConsoleError, e:
tools/xm-test/tests/migrate/01_migrate_localhost_pos.py +5 -12
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/migrate/01_migrate_localhost_pos.py
@@ -25,29 +25,21 @@
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("foo")
     # Set a variable to check on the other side
     run = console.runCmd("foo=bar")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 old_domid = domid(domain.getName())
 
@@ -68,11 +60,12 @@
 
 # Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
+    console = domain.getConsole()
     console.debugMe = True
 except ConsoleError, e:
     pass
 
+console.setHistorySaveCmds(value=True)
 console.sendInput("ls")
 
 # Run 'ls'
@@ -86,7 +79,7 @@
     FAIL("Migrated domain has been reset")
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/network-attach/01_network_attach_pos.py +2 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network-attach/01_network_attach_pos.py
@@ -15,22 +15,14 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -45,7 +37,7 @@
 
 ##
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py +2 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py
@@ -17,22 +17,14 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -51,7 +43,7 @@
 
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py +3 -12
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py
@@ -17,25 +17,16 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-    # network-detach is crashing, so we enable console debugging
-    # for now, so that reports include the oops
-    console.debugMe = True
-except ConsoleError, e:
-    FAIL(str(e))
+console.debugMe = True
 
 try:
-    # Activate the console
-    console.sendInput("input")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -54,7 +45,7 @@
         FAIL(msg)
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/network/02_network_local_ping_pos.py +1 -11
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network/02_network_local_ping_pos.py
@@ -35,24 +35,14 @@
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-
-# Attach a console
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("bhs")
-
     # Bring up the "lo" interface.
     console.runCmd("ifconfig lo 127.0.0.1")
 
tools/xm-test/tests/network/03_network_local_tcp_pos.py +1 -11
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network/03_network_local_tcp_pos.py
@@ -40,24 +40,14 @@
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-
-# Attach a console
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("bhs")
-
     # Bring up the "lo" interface.
     console.runCmd("ifconfig lo 127.0.0.1")
 
tools/xm-test/tests/network/04_network_local_udp_pos.py +1 -11
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network/04_network_local_udp_pos.py
@@ -39,24 +39,14 @@
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-
-# Attach a console
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("bhs")
-
     # Bring up the "lo" interface.
     console.runCmd("ifconfig lo 127.0.0.1")
 
tools/xm-test/tests/network/05_network_dom0_ping_pos.py +1 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network/05_network_dom0_ping_pos.py
@@ -40,20 +40,11 @@
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
-    FAIL(str(e))
-
-
-# Attach a console
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-    # Activate the console
-    console.sendInput("bhs")
-except ConsoleError, e:
     FAIL(str(e))
 
 try:
tools/xm-test/tests/network/06_network_dom0_tcp_pos.py +1 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network/06_network_dom0_tcp_pos.py
@@ -40,20 +40,11 @@
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
-    FAIL(str(e))
-
-
-# Attach a console
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-    # Activate the console
-    console.sendInput("bhs")
-except ConsoleError, e:
     FAIL(str(e))
 
 try:
tools/xm-test/tests/network/07_network_dom0_udp_pos.py +1 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network/07_network_dom0_udp_pos.py
@@ -40,20 +40,11 @@
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
-    FAIL(str(e))
-
-
-# Attach a console
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-    # Activate the console
-    console.sendInput("bhs")
-except ConsoleError, e:
     FAIL(str(e))
 
 try:
tools/xm-test/tests/network/11_network_domU_ping_pos.py +1 -8
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network/11_network_domU_ping_pos.py
@@ -25,18 +25,11 @@
 
     dom = XmTestDomain(extraConfig=config)
     try:
-        dom.start()
+        console = dom.start()
     except DomainError, e:
         if verbose:
             print "Failed to create test domain because:"
             print e.extra
-        FAIL(str(e))
-    try:
-        # Attach a console
-        console = XmConsole(dom.getName(), historySaveCmds=True)
-        # Activate the console
-        console.sendInput("bhs")
-    except ConsoleError, e:
         FAIL(str(e))
     return console
     
tools/xm-test/tests/network/12_network_domU_tcp_pos.py +1 -8
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network/12_network_domU_tcp_pos.py
@@ -25,18 +25,11 @@
 
     dom = XmTestDomain(extraConfig=config)
     try:
-        dom.start()
+        console = dom.start()
     except DomainError, e:
         if verbose:
             print "Failed to create test domain because:"
             print e.extra
-        FAIL(str(e))
-    try:
-        # Attach a console
-        console = XmConsole(dom.getName(), historySaveCmds=True)
-        # Activate the console
-        console.sendInput("bhs")
-    except ConsoleError, e:
         FAIL(str(e))
     return console
     
tools/xm-test/tests/network/13_network_domU_udp_pos.py +1 -8
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/network/13_network_domU_udp_pos.py
@@ -25,18 +25,11 @@
 
     dom = XmTestDomain(extraConfig=config)
     try:
-        dom.start()
+        console = dom.start()
     except DomainError, e:
         if verbose:
             print "Failed to create test domain because:"
             print e.extra
-        FAIL(str(e))
-    try:
-        # Attach a console
-        console = XmConsole(dom.getName(), historySaveCmds=True)
-        # Activate the console
-        console.sendInput("bhs")
-    except ConsoleError, e:
         FAIL(str(e))
     return console
     
tools/xm-test/tests/pause/01_pause_basic_pos.py +5 -12
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/pause/01_pause_basic_pos.py
@@ -20,29 +20,21 @@
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("foo")
     # Make sure a command succeeds
     run = console.runCmd("ls")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Pause the domain
 status, output = traceCommand("xm pause %s" % domain.getName())
@@ -51,7 +43,8 @@
 
 # Try to attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
+    console = domain.getConsole()
+    console.setHistorySaveCmds(value=True)
     run = console.runCmd("ls")
     #If we get here, console attached to paused domain (unexpected)
     FAIL("console attached to supposedly paused domain")
@@ -59,7 +52,7 @@
     pass
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 status, output = traceCommand("xm unpause %s" % domain.getName())
 if status != 0:
tools/xm-test/tests/pause/02_pause_badopt_neg.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/pause/02_pause_badopt_neg.py
@@ -11,7 +11,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/reboot/01_reboot_basic_pos.py +4 -9
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/reboot/01_reboot_basic_pos.py
@@ -11,19 +11,14 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-console.closeConsole()
+domain.closeConsole()
 
 status, output = traceCommand("xm reboot %s" % domain.getName())
 
@@ -33,7 +28,7 @@
 time.sleep(15)
 
 try:
-    console = XmConsole(domain.getName())
+    console = domain.getConsole()
 except ConsoleError, e:
     FAIL(str(e))
 
@@ -43,7 +38,7 @@
 except ConsoleError, e:
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 domain.destroy()
 
tools/xm-test/tests/reboot/02_reboot_badopt_neg.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/reboot/02_reboot_badopt_neg.py
@@ -11,7 +11,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/restore/01_restore_basic_pos.py +4 -6
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/restore/01_restore_basic_pos.py
@@ -18,7 +18,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
@@ -27,13 +27,11 @@
 
 # Make sure the domain isn't DOA
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
     console.runCmd("foo=bar")
 except ConsoleError, e:
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 # Save it out
 try:
@@ -67,7 +65,7 @@
 
 # Make sure it's alive
 try:
-    newConsole = XmConsole(domain.getName())
+    newConsole = domain.getConsole()
     # Enable debug dumping because this generates a Oops on x86_64
     newConsole.debugMe = True
     newConsole.sendInput("ls")
@@ -77,7 +75,7 @@
 except ConsoleError, e:
     FAIL("Restored domain is dead (%s)" % str(e))
 
-newConsole.closeConsole()
+domain.closeConsole()
 
 # This only works because the domain
 # still has the same name
tools/xm-test/tests/restore/04_restore_withdevices_pos.py +3 -6
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/restore/04_restore_withdevices_pos.py
@@ -23,14 +23,11 @@
     FAIL("Unable to mke2fs /dev/ram1 in dom0")
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     FAIL(str(e))
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("foo")
-
     run = console.runCmd("mkdir /mnt/a /mnt/b")
     if run["return"] != 0:
         FAIL("Unable to mkdir /mnt/a /mnt/b")
@@ -67,7 +64,7 @@
 except ConsoleError, e:
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 try:
     s, o = traceCommand("xm save %s /tmp/test.state" % domain.getName(),
@@ -91,7 +88,7 @@
     FAIL("xm restore exited with %i != 0" % s)
 
 try:
-    console = XmConsole(domain.getName())
+    console = domain.getConsole()
     # Enable debug dumping, as this causes an Oops on x86_64
     console.debugMe = True
 
tools/xm-test/tests/save/01_save_basic_pos.py +2 -8
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/save/01_save_basic_pos.py
@@ -13,20 +13,14 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Make sure the domain isn't DOA
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-console.closeConsole()
+domain.closeConsole()
 
 # Save it out
 try:
tools/xm-test/tests/save/03_save_bogusfile_neg.py +2 -8
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/save/03_save_bogusfile_neg.py
@@ -16,20 +16,14 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Make sure the domain isn't DOA
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-console.closeConsole()
+domain.closeConsole()
 
 # Save it out
 status, output = traceCommand("xm save %s /NOWHERE/test.state" % domain.getName())
tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py
@@ -14,7 +14,7 @@
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py
@@ -16,7 +16,7 @@
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py
@@ -16,7 +16,7 @@
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py
@@ -14,7 +14,7 @@
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/sedf/05_sedf_extratime_pos.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/sedf/05_sedf_extratime_pos.py
@@ -14,7 +14,7 @@
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py
@@ -14,7 +14,7 @@
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/shutdown/01_shutdown_basic_pos.py +2 -10
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/shutdown/01_shutdown_basic_pos.py
@@ -19,29 +19,21 @@
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("foo")
     # Make sure a command succeeds
     run = console.runCmd("ls /bin")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 status, output = traceCommand("xm shutdown %s" % domain.getName())
tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py
@@ -20,7 +20,7 @@
 
 # Start it
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/sysrq/02_sysrq_sync_pos.py +2 -11
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/sysrq/02_sysrq_sync_pos.py
@@ -17,19 +17,12 @@
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
-
-# Attach a console to it
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
 
 status, output = traceCommand("xm sysrq %s s" % domain.getName())
 
@@ -40,15 +33,13 @@
 
 # Run 'ls'
 try:
-    # Activate the console
-    console.sendInput("foo")
     # Check the dmesg output on the domU
     run = console.runCmd("dmesg | grep Emerg\n")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py +1 -7
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py
@@ -13,7 +13,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create domain:"
@@ -27,12 +27,6 @@
 # Wait for the reboot to finish
 time.sleep(20)
 
-try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
-except ConsoleError, e:
-    FAIL(str(e))
-
 status, output = traceCommand("xm sysrq %s s" % domain.getName())
 if status != 0:
     FAIL("sysrq failed with %i != 0" % status)
tools/xm-test/tests/unpause/01_unpause_basic_pos.py +4 -12
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/unpause/01_unpause_basic_pos.py
@@ -22,29 +22,21 @@
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("foo")
     # Make sure a command succeeds
     run = console.runCmd("ls")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 seed(time.time())
 
@@ -69,13 +61,13 @@
 
 # Are we still alive after all that?
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
+    console = domain.getConsole()
     run = console.runCmd("ls")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 if run["return"] != 0:
     FAIL("console failed to attach to supposedly unpaused domain")
tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py
@@ -42,7 +42,7 @@
 domain = XmTestDomain(extraConfig={"vcpus":2})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py
@@ -20,7 +20,7 @@
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
tools/xm-test/tests/vtpm/01_vtpm-list_pos.py +1 -1
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/vtpm/01_vtpm-list_pos.py
@@ -16,7 +16,7 @@
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print e.extra
tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py +2 -8
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py
@@ -16,7 +16,7 @@
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -24,12 +24,6 @@
     FAIL("Unable to create domain")
 
 domName = domain.getName()
-
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    vtpm_cleanup(domName)
-    FAIL(str(e))
 
 try:
     console.sendInput("input")
@@ -49,7 +43,7 @@
     vtpm_cleanup(domName)
     FAIL("TPM frontend support not compiled into (domU?) kernel")
 
-console.closeConsole()
+domain.closeConsole()
 
 domain.stop()
 
tools/xm-test/tests/vtpm/03_vtpm-susp_res.py +11 -14
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/vtpm/03_vtpm-susp_res.py
@@ -15,9 +15,10 @@
 
 config = {"vtpm":"instance=1,backend=0"}
 domain = XmTestDomain(extraConfig=config)
+consoleHistory = ""
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -25,12 +26,6 @@
     FAIL("Unable to create domain")
 
 domName = domain.getName()
-
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    vtpm_cleanup(domName)
-    FAIL(str(e))
 
 try:
     console.sendInput("input")
@@ -50,19 +45,21 @@
     vtpm_cleanup(domName)
     FAIL("TPM frontend support not compiled into (domU?) kernel")
 
-console.closeConsole()
+consoleHistory = console.getHistory()
+domain.closeConsole()
 
 try:
     status, ouptut = traceCommand("xm save %s %s.save" %
                                   (domName, domName),
                                   timeout=30)
+
 except TimeoutError, e:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL(str(e))
 
 if status != 0:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL("xm save did not succeed")
 
@@ -72,19 +69,19 @@
                                   timeout=30)
 except TimeoutError, e:
     os.remove("%s.save" % domName)
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL(str(e))
 
 os.remove("%s.save" % domName)
 
 if status != 0:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL("xm restore did not succeed")
 
 try:
-    console = XmConsole(domain.getName())
+    console = domain.getConsole()
 except ConsoleError, e:
     vtpm_cleanup(domName)
     FAIL(str(e))
@@ -96,7 +93,7 @@
     vtpm_cleanup(domName)
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 domain.stop()
 
tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py +8 -12
diff -r 5562ee51bb75 -r 45aaca4aed38 tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
@@ -15,9 +15,10 @@
 
 config = {"vtpm":"instance=1,backend=0"}
 domain = XmTestDomain(extraConfig=config)
+consoleHistory = ""
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -25,12 +26,6 @@
     FAIL("Unable to create domain")
 
 domName = domain.getName()
-
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    vtpm_cleanup(domName)
-    FAIL(str(e))
 
 try:
     console.sendInput("input")
@@ -50,7 +45,8 @@
     vtpm_cleanup(domName)
     FAIL("TPM frontend support not compiled into (domU?) kernel")
 
-console.closeConsole()
+consoleHistory = console.getHistory()
+domain.closeConsole()
 
 old_domid = domid(domName)
 
@@ -59,12 +55,12 @@
                                   domName,
                                   timeout=90)
 except TimeoutError, e:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL(str(e))
 
 if status != 0:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL("xm migrate did not succeed. External device migration activated?")
 
@@ -77,7 +73,7 @@
     FAIL("xm migrate failed, domain id is still %s" % old_domid)
 
 try:
-    console = XmConsole(domain.getName())
+    console = domain.getConsole()
 except ConsoleError, e:
     vtpm_cleanup(domName)
     FAIL(str(e))
@@ -89,7 +85,7 @@
     vtpm_cleanup(domName)
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 domain.stop()
 

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