quick fix for qemu start/stop on remote testboxes
[tests.git] / system / TestPlc.py
index ad43ada..df4d431 100644 (file)
@@ -37,15 +37,27 @@ def standby_generic (func):
 def node_mapper (method):
     def actual(self):
         overall=True
+        node_method = TestNode.__dict__[method.__name__]
         for site_spec in self.plc_spec['sites']:
             test_site = TestSite (self,site_spec)
             for node_spec in site_spec['nodes']:
                 test_node = TestNode (self,test_site,node_spec)
-                node_method = TestNode.__dict__[method.__name__]
                 if not node_method(test_node): overall=False
         return overall
     return actual
 
+def slice_mapper_options (method):
+    def actual(self):
+        overall=True
+        slice_method = TestSlice.__dict__[method.__name__]
+        for slice_spec in self.plc_spec['slices']:
+            site_spec = self.locate_site (slice_spec['sitename'])
+            test_site = TestSite(self,site_spec)
+            test_slice=TestSlice(self,test_site,slice_spec)
+            if not slice_method(test_slice,self.options): overall=False
+        return overall
+    return actual
+
 class TestPlc:
 
     def __init__ (self,plc_spec,options):
@@ -169,7 +181,7 @@ class TestPlc:
                 test_node = TestNode (self, test_site, node_spec)
                 if not test_node.is_real():
                     tuples.append( (test_node.host_box(),test_node) )
-        # transform into a dict { 'host_box' -> [ hostnames .. ] }
+        # transform into a dict { 'host_box' -> [ test_node .. ] }
         result = {}
         for (box,node) in tuples:
             if not result.has_key(box):
@@ -186,9 +198,11 @@ class TestPlc:
 
     # make this a valid step
     def kill_all_qemus(self):
+        # this is the brute force version, kill all qemus on that host box
         for (box,nodes) in self.gather_hostBoxes().iteritems():
-            # this is the brute force version, kill all qemus on that host box
-            TestBox(box,self.options.buildname).kill_all_qemus()
+            # 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)
         return True
 
     # make this a valid step
@@ -561,15 +575,11 @@ class TestPlc:
                 utils.header('Created Slice %s'%slice['slice_fields']['name'])
         return True
         
-    def check_slices(self):
-        for slice_spec in self.plc_spec['slices']:
-            site_spec = self.locate_site (slice_spec['sitename'])
-            test_site = TestSite(self,site_spec)
-            test_slice=TestSlice(self,test_site,slice_spec)
-            status=test_slice.do_check_slice(self.options)
-            if (not status):
-                return False
-        return status
+    @slice_mapper_options
+    def check_slice(self): pass
+
+    @node_mapper
+    def clear_known_hosts (self): pass
     
     def start_nodes (self):
         utils.header("Starting  nodes")
@@ -577,7 +587,6 @@ class TestPlc:
             TestSite(self,site_spec).start_nodes (self.options)
         return True
 
-
     def locate_first_sliver (self):
         slice_spec = self.plc_spec['slices'][0]
         slicename = slice_spec['slice_fields']['name']
@@ -647,7 +656,7 @@ class TestPlc:
         return True
 
     def gather_var_logs (self):
-        to_plc = self.actual_command_in_guest("tar -cf - /var/log")        
+        to_plc = self.actual_command_in_guest("tar -C /var/log/ -cf - .")        
         command = to_plc + "| tar -C logs/%s-var-log -xf -"%self.name()
         utils.system("mkdir -p logs/%s-var-log"%self.name())
         utils.system(command)