Only copy symlink name of logs

devstack creates a shortened symlink without timestamp (foo.log ->
foo.2014-01-01-000000.log) for each log to latest log. Thus we just
copy the symlinks to avoid excessively long file-names.

This removes the need to remove duplicate log files, which was
incorrectly removing grenade.sh.log (because it has multiple '.'s and
kind of looks like the time-stampped log files)

The grenade log cleanup is added in a separate section.  In general,
it should be better to clean-up logs in a more specific fashion like
this to avoid the situtation where a glob match removes things we
really want.

Also, there is no $BASE/new/devstacklog.txt.  The devstack upgrade
process is driven by grenade.sh which calls parts of devstack
directly; so all relevant log output goes into grenade.sh.log

Change-Id: Ib1c4476c28c5c032ed9ab1682118a4f4528db450
This commit is contained in:
Ian Wienand 2014-05-22 11:16:33 +10:00
parent 26f527d593
commit bd45571beb
1 changed files with 14 additions and 10 deletions

View File

@ -441,9 +441,15 @@ function cleanup_host {
fi
done
# copy devstack log files
if [ -d $BASE/old ]; then
sudo mkdir -p $BASE/logs/old $BASE/logs/new $BASE/logs/grenade
sudo cp $BASE/old/screen-logs/* $BASE/logs/old/
# copy all log files, but note that devstack creates a shortened
# symlink without timestamp (foo.log -> foo.2014-01-01-000000.log)
# for each log to latest log. Thus we just copy the symlinks to
# avoid excessively long file-names.
find $BASE/old/screen-logs -type l -print0 | \
xargs -0 -I {} sudo cp {} $BASE/logs/old
sudo cp $BASE/old/devstacklog.txt $BASE/logs/old/
sudo cp $BASE/old/devstack/localrc $BASE/logs/old/localrc.txt
sudo cp $BASE/old/tempest/etc/tempest.conf $BASE/logs/old/tempest_conf.txt
@ -452,10 +458,15 @@ function cleanup_host {
else
NEWLOGTARGET=$BASE/logs
fi
sudo cp $BASE/new/screen-logs/* $NEWLOGTARGET/
sudo cp $BASE/new/devstacklog.txt $NEWLOGTARGET/
find $BASE/new/screen-logs -type l -print0 | \
xargs -0 -I {} sudo cp {} $NEWLOGTARGET/
sudo cp $BASE/new/devstack/localrc $NEWLOGTARGET/localrc.txt
# $BASE/logs is a link to $WORKSPACE (see
# devstack-vm-gate-wrap.sh) so we need to clear out a few extra
# logs files we don't want to keep
sudo rm $BASE/logs/grenade.sh.log.*
# Copy tempest config file
sudo cp $BASE/new/tempest/etc/tempest.conf $NEWLOGTARGET/tempest_conf.txt
@ -520,13 +531,6 @@ function cleanup_host {
find $BASE/logs/rabbitmq -type f -exec mv '{}' '{}'.txt \;
fi
# Remove duplicate logs
sudo rm $BASE/logs/*.*.txt
if [ -d $BASE/old ]; then
sudo rm $BASE/logs/old/*.*.txt
sudo rm $BASE/logs/new/*.*.txt
fi
# Compress all text logs
sudo find $BASE/logs -iname '*.txt' -execdir gzip -9 {} \+
sudo find $BASE/logs -iname '*.dat' -execdir gzip -9 {} \+