From 18ef017ba316dd1d5af6c58e6af18c58478ececc Mon Sep 17 00:00:00 2001 From: Nathan Cutler Date: Sat, 9 Sep 2017 08:52:51 +0200 Subject: [PATCH] tests: deepsea: harvest /var/log/deepsea.log The new deepsea CLI logs to /var/log/deepsea.log; harvest this logfile. Signed-off-by: Nathan Cutler --- qa/tasks/deepsea.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/qa/tasks/deepsea.py b/qa/tasks/deepsea.py index add99639ab07f..1e16038eabcb4 100644 --- a/qa/tasks/deepsea.py +++ b/qa/tasks/deepsea.py @@ -2,6 +2,7 @@ Task to deploy clusters with DeepSea ''' import logging +import os.path import time from teuthology import misc @@ -214,7 +215,26 @@ class DeepSea(Task): 'xargs', '-0', '--no-run-if-empty', '--', 'gzip', '--' ]) + def gather_logfile(self, logfile): + for _remote in self.ctx.cluster.remotes.iterkeys(): + try: + _remote.run(args = [ + 'sudo', 'test', '-f', '/var/log/{}'.format(logfile), + ]) + except CommandFailedError: + continue + self.log.info("Gathering logfile /var/log/{} from remote {}" + .format(logfile, _remote.hostname)) + _remote.run(args = [ + 'sudo', 'cp', '-a', '/var/log/{}'.format(logfile), + '/home/ubuntu/cephtest/archive/', + run.Raw(';'), + 'sudo', 'chown', 'ubuntu', + '/home/ubuntu/cephtest/archive/{}'.format(logfile) + ]) + def end(self): + self.gather_logfile('deepsea.log') self.purge_osds() self.gather_logs('salt') self.gather_logs('ganesha') -- 2.39.5