From 2adeecd8206ee4c384571c89b27fbdc28622d524 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Sun, 19 May 2013 20:20:14 +0100 Subject: [PATCH] Get logs and config from bootstrap node --- toci_functions.sh | 6 ++++++ toci_setup.sh | 4 ++++ toci_test.sh | 3 +++ 3 files changed, 13 insertions(+) diff --git a/toci_functions.sh b/toci_functions.sh index a974a2786..eb9369289 100644 --- a/toci_functions.sh +++ b/toci_functions.sh @@ -42,3 +42,9 @@ apply_patches(){ mark_time(){ echo $(date) : $@ } + +# Get config files and logs from a host for debuging purposes +get_state_from_host(){ + ssh_noprompt root@$BOOTSTRAP_IP "( set -x ; ps -ef ; df -h ; uptime ; netstat -lpn ; iptables-save ; brctl show ; ip addr) > /var/log/host_info.txt 2>&1 ; + tar -czf - /var/log /etc" > $TOCI_LOG_DIR/bootstraplogs.tgz +} diff --git a/toci_setup.sh b/toci_setup.sh index f35084a37..fc919c8f3 100755 --- a/toci_setup.sh +++ b/toci_setup.sh @@ -44,6 +44,10 @@ DIB_PATH=$TOCI_WORKING_DIR/stackforge_diskimage-builder \ scripts/boot-elements boot-stack -o bootstrap BOOTSTRAP_IP=`scripts/get-vm-ip bootstrap` + +# Get logs from the node on error +trap get_state_from_host ERR + # We're going to wait for it to finish firstboot wait_for 60 10 ssh_noprompt root@$BOOTSTRAP_IP ls /opt/stack/boot-stack/boot-stack.done diff --git a/toci_test.sh b/toci_test.sh index 642e72fbf..84d06db73 100755 --- a/toci_test.sh +++ b/toci_test.sh @@ -6,6 +6,9 @@ set -xe cd $TOCI_WORKING_DIR/tripleo_incubator BOOTSTRAP_IP=`scripts/get-vm-ip bootstrap` +# Get logs from the node on exit +trap get_state_from_host EXIT + scp_noprompt root@$BOOTSTRAP_IP:stackrc $TOCI_WORKING_DIR/stackrc sed -i "s/localhost/$BOOTSTRAP_IP/" $TOCI_WORKING_DIR/stackrc source $TOCI_WORKING_DIR/stackrc