*Manage nodes log files into a .tar
authorSapan Bhatia <sapanb@cs.princeton.edu>
Tue, 18 Mar 2008 14:57:10 +0000 (14:57 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Tue, 18 Mar 2008 14:57:10 +0000 (14:57 +0000)
system/TestBox.py
system/TestNode.py

index 7b6fa6b..9e94a87 100644 (file)
@@ -17,7 +17,14 @@ class TestBox:
 
     def is_local(self):
         return utils.is_local (self.hostname())
-
+    
+    def tar_logs(self):
+        if os.path.isdir("nodeslogs"):
+            tar_command="tar cvf nodeslogs.tar nodeslogs/ && rm -rf nodeslogs"
+            self.run_in_buildname (tar_command)
+            return True
+        return False
+    
     def run_in_buildname (self,command):
         if self.is_local():
             return utils.system(command)
index d963ec2..aacd63d 100644 (file)
@@ -105,6 +105,8 @@ class TestNode:
     def prepare_area(self):
         utils.system("rm -rf %s"%self.areaname())
         utils.system("mkdir %s"%self.areaname())
+        #create the tar log file
+        utils.system("rm -rf nodeslogs && mkdir nodeslogs")
         if self.is_qemu():
             utils.system("rsync -v -a --exclude .svn template-qemu/ %s/"%self.areaname())
 
@@ -151,12 +153,15 @@ class TestNode:
         test_box = self.test_box()
         utils.header("Starting qemu node %s on %s"%(self.name(),test_box.hostname()))
 
-        test_box.run_in_buildname("qemu-%s/env-qemu start >> qemu-%s/env-qemu.log"%(
-                self.name(),self.name()))
-        test_box.run_in_buildname("qemu-%s/start-qemu-node 2>&1 >> qemu-%s/start-qemu-node.log &"%(
+        test_box.run_in_buildname("qemu-%s/env-qemu start >> nodeslogs/%s.log"%(self.name(),self.name()))
+        test_box.run_in_buildname("qemu-%s/start-qemu-node 2>&1 >> nodeslogs/%s.log &"%(
                 self.name(),self.name()))
 
     def kill_qemu (self):
+        #Prepare the log file before killing the nodes
+        test_box = self.test_box()
+        if(not test_box.tar_logs()):
+            utils.header("Failed to get the nodes log files")
         # kill the right processes 
         utils.header("Stopping qemu for host %s on box %s"%(self.name(),self.test_box().hostname()))
         command="qemu_kill.sh %s"%self.name()