bifrost/scripts/collect-test-info.sh
stephane 6457561b21 Separate log collection into its own script
Avoid having too much duplicated stuff by moving log
collection into its own script as suggested in
https://review.openstack.org/#/c/264366/1/scripts/test-bifrost-venv.sh@80

Change-Id: I2e322fc1f12e270c9407e7320d0d0e8c5452c4af
2016-01-29 07:19:46 -08:00

22 lines
845 B
Bash
Executable File

#!/bin/bash
set -eux
set -o pipefail
# Note(TheJulia): If there is a workspace variable, we want to utilize that as
# the preference of where to put logs
SCRIPT_HOME="$(cd "$(dirname "$0")" && pwd)"
LOG_LOCATION="${WORKSPACE:-${SCRIPT_HOME}/..}/logs"
echo "Making logs directory and collecting logs."
[ -d ${LOG_LOCATION} ] || mkdir -p ${LOG_LOCATION}
sudo cp /var/log/libvirt/baremetal_logs/testvm1_console.log ${LOG_LOCATION}
sudo chown $USER ${LOG_LOCATION}/testvm1_console.log
dmesg &> ${LOG_LOCATION}/dmesg.log
sudo netstat -apn &> ${LOG_LOCATION}/netstat.log
sudo iptables -L -n -v &> ${LOG_LOCATION}/iptables.log
sudo cp /var/log/upstart/ironic-api.log ${LOG_LOCATION}/
sudo chown $USER ${LOG_LOCATION}/ironic-api.log
sudo cp /var/log/upstart/ironic-conductor.log ${LOG_LOCATION}/
sudo chown $USER ${LOG_LOCATION}/ironic-conductor.log