From a3706f0e49a239a37817bb95546d3b1605f0756d Mon Sep 17 00:00:00 2001 From: Fatih Degirmenci Date: Wed, 31 Aug 2016 21:10:24 +0200 Subject: [PATCH] Fix log collection when VMs are created with non-default names The change I4c9eec82882d94649ee0e6bdb7e2ce033c29e44a introduced the ability to create VMs with user defined names. This change aligns the VM log collection accordingly. Change-Id: I8c4895a8f49749b6845a804b02ad64bc227ec3ec Signed-off-by: Fatih Degirmenci --- scripts/collect-test-info.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/collect-test-info.sh b/scripts/collect-test-info.sh index a43fc3b33..8b62421fd 100755 --- a/scripts/collect-test-info.sh +++ b/scripts/collect-test-info.sh @@ -12,9 +12,18 @@ 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/testvm[[:digit:]]_console.log ${LOG_LOCATION} -sudo chown $USER ${LOG_LOCATION}/testvm[[:digit:]]_console.log -sudo chmod o+r ${LOG_LOCATION}/testvm[[:digit:]]_console.log + +if [ -z "${TEST_VM_NODE_NAMES}" ]; then + sudo cp /var/log/libvirt/baremetal_logs/testvm[[:digit:]]_console.log ${LOG_LOCATION} + sudo chown $USER ${LOG_LOCATION}/testvm[[:digit:]]_console.log + sudo chmod o+r ${LOG_LOCATION}/testvm[[:digit:]]_console.log +else + for TEST_VM_NODE_NAME in ${TEST_VM_NODE_NAMES}; do + sudo cp /var/log/libvirt/baremetal_logs/${TEST_VM_NODE_NAME}_console.log ${LOG_LOCATION} + sudo chown $USER ${LOG_LOCATION}/${TEST_VM_NODE_NAME}_console.log + sudo chmod o+r ${LOG_LOCATION}/${TEST_VM_NODE_NAME}_console.log + done +fi dmesg &> ${LOG_LOCATION}/dmesg.log # NOTE(TheJulia): Netstat exits with error code 5 when --version is used. sudo netstat -apn &> ${LOG_LOCATION}/netstat.log