fix for when a test involving remote qemu boxes is run twice
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 8 Apr 2008 15:25:50 +0000 (15:25 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 8 Apr 2008 15:25:50 +0000 (15:25 +0000)
system/TestBox.py
system/TestNode.py
system/TestPlc.py
system/step_fresh_install.py

index 462b152..5bcdf40 100644 (file)
@@ -37,8 +37,8 @@ class TestBox:
         return self.test_ssh.mkdir(dirname)
 
     # we need at least one nodename, as template-qemu is not synced on remote testboxes
-    def kill_all_qemus(self,nodename):
-        self.run_in_buildname("qemu-%s/qemu-kill-node"%nodename)
+    def kill_all_qemus(self,nodedir):
+        self.run_in_buildname("%s/qemu-kill-node"%nodedir)
         return True
 
     def list_all_qemus(self):
index 3f2e8b3..3178297 100644 (file)
@@ -154,10 +154,14 @@ class TestNode:
         file.write('IP=%s\n'%ip)
         file.write('TARGET_ARCH=%s\n'%target_arch)
         file.close()
+        return True
 
+    def export_qemu (self):
         # if relevant, push the qemu area onto the host box
         if self.test_box().is_local():
             return True
+        utils.header ("Cleaning any former sequel of %s on %s"%(self.name(),self.host_box()))
+        self.test_box().run_in_buildname("rm -rf %s"%self.nodedir())
         utils.header ("Transferring configuration files for node %s onto %s"%(self.name(),self.host_box()))
         return self.test_box().copy(self.nodedir(),recursive=True)==0
             
@@ -181,7 +185,7 @@ class TestNode:
 
     def list_qemu (self):
         utils.header("Listing qemu for host %s on box %s"%(self.name(),self.test_box().hostname()))
-        command="qemu-%s/qemu-kill-node -l %s"%(self.name(),self.name())
+        command="%s/qemu-kill-node -l %s"%(self.nodedir(),self.name())
         self.test_box().run_in_buildname(command)
         return True
 
@@ -190,7 +194,7 @@ class TestNode:
         test_box = self.test_box()
         # kill the right processes 
         utils.header("Stopping qemu for host %s on box %s"%(self.name(),self.test_box().hostname()))
-        command="qemu-%s/qemu-kill-node %s"%(self.name(),self.name())
+        command="%s/qemu-kill-node %s"%(self.nodedir(),self.name())
         self.test_box().run_in_buildname(command)
         return True
 
index 5781ad8..195aa7d 100644 (file)
@@ -66,7 +66,7 @@ class TestPlc:
                      'configure', 'start', SEP,
                      'store_keys', 'clear_known_hosts', 'initscripts', SEP,
                      'sites', 'nodes', 'slices', 'nodegroups', SEP,
-                     'init_node','bootcd', 'configure_qemu', 
+                     'init_node','bootcd', 'configure_qemu', 'export_qemu',
                      'kill_all_qemus', 'reinstall_node','start_node', SEP,
                      'standby_20', SEP,
                      'nodes_booted', 'nodes_ssh', 'check_slice',
@@ -227,8 +227,8 @@ class TestPlc:
         # this is the brute force version, kill all qemus on that host box
         for (box,nodes) in self.gather_hostBoxes().iteritems():
             # pass the first nodename, as we don't push template-qemu on testboxes
-            nodename=nodes[0].name()
-            TestBox(box,self.options.buildname).kill_all_qemus(nodename)
+            nodedir=nodes[0].nodedir()
+            TestBox(box,self.options.buildname).kill_all_qemus(nodedir)
         return True
 
     # make this a valid step
@@ -556,6 +556,8 @@ class TestPlc:
     def configure_qemu (self): pass
     @node_mapper
     def reinstall_node (self): pass
+    @node_mapper
+    def export_qemu (self): pass
         
     def do_check_initscripts(self):
         overall = True
index 90afd7d..399e893 100644 (file)
@@ -1,15 +1,11 @@
-import utils
 from TestPlc import TestPlc
 
-# requirement is to implement
-# run* (plc_spec, options)
-
-def run01_uninstall (test_plc,options):
-    return test_plc.uninstall(options)
-def run02_install (test_plc,options):
-    return test_plc.install(options)
-def run03_configure (test_plc,options):
-    return test_plc.configure(options)
-def run04_dump_just_installed (test_plc,options):
+def run01_uninstall (test_plc):
+    return test_plc.uninstall()
+def run02_install (test_plc):
+    return test_plc.install()
+def run03_configure (test_plc):
+    return test_plc.configure()
+def run04_dump_just_installed (test_plc):
     options.dbname='just-installed'
-    return test_plc.db_dump(options)
+    return test_plc.db_dump()