From: Michael Fritch Date: Fri, 28 Feb 2020 21:46:59 +0000 (-0700) Subject: qa/workunits/cephadm/test_cephadm.sh: dump logs on exit X-Git-Tag: v15.1.1~195^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5bdcf00e873e43ece436d2868eb55312e340d8c0;p=ceph-ci.git qa/workunits/cephadm/test_cephadm.sh: dump logs on exit dumps the last few lines from each of the surviving daemon logs Signed-off-by: Michael Fritch --- diff --git a/qa/workunits/cephadm/test_cephadm.sh b/qa/workunits/cephadm/test_cephadm.sh index 15ed7f71475..cc273343631 100755 --- a/qa/workunits/cephadm/test_cephadm.sh +++ b/qa/workunits/cephadm/test_cephadm.sh @@ -14,6 +14,7 @@ TMPDIR=$(mktemp -d) function cleanup() { + dump_all_logs rm -rf $TMPDIR } trap cleanup EXIT @@ -111,6 +112,32 @@ function is_available() true } +function dump_log() +{ + local name="$1" + local num_lines="$2" + + if [ -z $num_lines ]; then + num_lines=100 + fi + + echo '-------------------------' + echo 'dump daemon log:' $name + echo '-------------------------' + + $CEPHADM logs --name $name -- --no-pager -n $num_lines +} + +function dump_all_logs() +{ + names=$($CEPHADM ls | jq -r '.[].name') + + echo 'dumping logs for daemons: ' $names + for name in $names; do + dump_log $name + done +} + ## prepare + check host $SUDO $CEPHADM check-host