+ def plcsh_stress_test (self):
+ # install the stress-test in the plc image
+ location = "/usr/share/plc_api/plcsh-stress-test.py"
+ remote="/vservers/%s/%s"%(self.vservername,location)
+ self.test_ssh.copy_abs("plcsh-stress-test.py",remote)
+ command = location
+ command += " -- --check"
+ if self.options.small_test:
+ command += " --tiny"
+ 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>/*
+ # (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)
+ print "-------------------- TestPlc.gather_logs : PLC's /var/log"
+ self.gather_var_logs ()
+ # (2)
+ print "-------------------- TestPlc.gather_logs : nodes's QEMU logs"
+ 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)
+ test_node.gather_qemu_logs()
+ # (3)
+ print "-------------------- TestPlc.gather_logs : nodes's /var/log"
+ self.gather_nodes_var_logs()
+ # (4)
+ print "-------------------- TestPlc.gather_logs : sample sliver's /var/log"
+ self.gather_slivers_var_logs()
+ return True
+
+ def gather_slivers_var_logs(self):
+ for test_sliver in self.all_sliver_objs():
+ remote = test_sliver.tar_var_logs()
+ utils.system("mkdir -p logs/sliver.var-log.%s"%test_sliver.name())
+ command = remote + " | tar -C logs/sliver.var-log.%s -xf -"%test_sliver.name()
+ utils.system(command)
+ return True
+
+ def gather_var_logs (self):
+ to_plc = self.actual_command_in_guest("tar -C /var/log/ -cf - .")
+ command = to_plc + "| tar -C logs/myplc.var-log.%s -xf -"%self.name()
+ utils.system("mkdir -p logs/myplc.var-log.%s"%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)
+ for node_spec in site_spec['nodes']:
+ test_node=TestNode(self,test_site,node_spec)
+ test_ssh = TestSsh (test_node.name(),key="/etc/planetlab/root_ssh_key.rsa")
+ to_plc = self.actual_command_in_guest ( test_ssh.actual_command("tar -C /var/log -cf - ."))
+ command = to_plc + "| tar -C logs/node.var-log.%s -xf -"%test_node.name()
+ utils.system("mkdir -p logs/node.var-log.%s"%test_node.name())
+ utils.system(command)
+
+