new step 'free_all' to cleanup everything about plc-vservers, qemus and trackers
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 15 Feb 2011 14:13:10 +0000 (15:13 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 15 Feb 2011 14:13:10 +0000 (15:13 +0100)
system/TestMain.py
system/TestPlc.py
system/step_free_all.py [new file with mode: 0644]

index e5989e1..4dff120 100755 (executable)
@@ -59,7 +59,12 @@ class TestMain:
                     try:
                         doc=testplc_method_dict[stepname].__doc__
                     except:
-                        doc=None
+                        try:
+                            # locate the step_<name> module
+                            modulename='step_'+stepname
+                            doc = __import__(modulename).__doc__
+                        except:
+                            doc=None
                     if doc: print doc
                     else:   print "*** no doc found"
 
index 601cdb0..c26908c 100644 (file)
@@ -104,8 +104,9 @@ class TestPlc:
         'force_gather_logs', 'force_local_post', SEP,
         ]
     other_steps = [ 
+        'free_all',
         'show_boxes', 'local_list','local_rel','local_rel_plc','local_rel_qemu',SEP,
-        'plc_stop', 'vs_start', SEP,
+        'plc_stop', 'vs_start', 'vs_stop', SEP,
         'delete_initscripts', 'delete_nodegroups','delete_all_sites', SEP,
         'delete_sites', 'delete_nodes', 'delete_slices', 'keys_clean', SEP,
         'delete_leases', 'list_leases', SEP,
@@ -172,6 +173,9 @@ class TestPlc:
     def start_guest (self):
       return utils.system(self.test_ssh.actual_command(self.start_guest_in_host()))
     
+    def stop_guest (self):
+      return utils.system(self.test_ssh.actual_command(self.stop_guest_in_host()))
+    
     def run_in_guest (self,command):
         return utils.system(self.actual_command_in_guest(command))
     
@@ -182,10 +186,13 @@ class TestPlc:
     def host_to_guest(self,command):
         return "vserver %s exec %s"%(self.vservername,command)
     
-    #command gets run in the vserver
+    #start/stop the vserver
     def start_guest_in_host(self):
         return "vserver %s start"%(self.vservername)
     
+    def stop_guest_in_host(self):
+        return "vserver %s stop"%(self.vservername)
+    
     # xxx quick n dirty
     def run_in_guest_piped (self,local,remote):
         return utils.system(local+" | "+self.test_ssh.actual_command(self.host_to_guest(remote),keep_stdin=True))
@@ -582,6 +589,11 @@ class TestPlc:
         self.start_guest()
         return True
 
+    def vs_stop (self):
+        "stop the PLC vserver"
+        self.stop_guest()
+        return True
+
     # stores the keys from the config for further use
     def keys_store(self):
         "stores test users ssh keys in keys/"
diff --git a/system/step_free_all.py b/system/step_free_all.py
new file mode 100644 (file)
index 0000000..daa1f55
--- /dev/null
@@ -0,0 +1,17 @@
+# Thierry Parmentelat <thierry.parmentelat@inria.fr>
+# Copyright (C) 2010 INRIA 
+#
+# a macro for releasing all local resources and cleanup trackers
+
+"release local resources (stop vs, kill qemus, clean trackers)"
+
+from TestPlc import TestPlc
+
+def run01_vs_stop (test_plc):
+    return test_plc.vs_stop()
+
+def run02_qemu_stop (test_plc):
+    return test_plc.qemu_kill_mine()
+
+def run03_free_trackers (test_plc):
+    return test_plc.local_rel()