capture pgsql logs
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 19 Sep 2008 10:49:06 +0000 (10:49 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 19 Sep 2008 10:49:06 +0000 (10:49 +0000)
system/TestPlc.py

index ede174e..0e2dc28 100644 (file)
@@ -749,13 +749,17 @@ class TestPlc:
         return ( self.run_in_guest(command) == 0)
 
     def gather_logs (self):
-        # (1) get the plc's /var/log and store it locally in logs/myplc.var-log.<plcname>/*
+        # (1.a) get the plc's /var/log/ and store it locally in logs/myplc.var-log.<plcname>/*
+        # (1.b) get the plc's  /var/lib/pgsql/data/pg_log/ -> logs/myplc.pgsql-log.<plcname>/*
         # (2) get all the nodes qemu log and store it as logs/node.qemu.<node>.log
         # (3) get the nodes /var/log and store is as logs/node.var-log.<node>/*
         # (4) as far as possible get the slice's /var/log as logs/sliver.var-log.<sliver>/*
-        # (1)
+        # (1.a)
         print "-------------------- TestPlc.gather_logs : PLC's /var/log"
         self.gather_var_logs ()
+        # (1.b)
+        print "-------------------- TestPlc.gather_logs : PLC's /var/lib/psql/data/pg_log/"
+        self.gather_pgsql_logs ()
         # (2) 
         print "-------------------- TestPlc.gather_logs : nodes's QEMU logs"
         for site_spec in self.plc_spec['sites']:
@@ -787,6 +791,12 @@ class TestPlc:
         command = "chmod a+r,a+x logs/myplc.var-log.%s/httpd"%self.name()
         utils.system(command)
 
+    def gather_pgsql_logs (self):
+        utils.system("mkdir -p logs/myplc.pgsql-log.%s"%self.name())
+        to_plc = self.actual_command_in_guest("tar -C /var/lib/pgsql/data/pg_log/ -cf - .")        
+        command = to_plc + "| tar -C logs/myplc.pgsql-log.%s -xf -"%self.name()
+        utils.system(command)
+
     def gather_nodes_var_logs (self):
         for site_spec in self.plc_spec['sites']:
             test_site = TestSite (self,site_spec)