From c6d2275f27f3b20e8d673b4361f4407b2f5ea4cf Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 19 May 2020 19:09:26 +0800 Subject: [PATCH] qa/tasks/cephadm: ignore tarfile.ReadError there is chance that /var/log/ceph (and other directories) is not created when cephadm fails, but we always try to collect /var/log/ceph by tar the directory on the test node and transfer it back for archiving it. when we fail to do so, an exception is thrown, and this exception is in turn logged as the cause of the failure instead of the one which fails the test. in this change, `tarfile.TarError`s is caught and ignored if it is thrown by `misc.pull_directory()`, as normally, we don't consider it a fatal failure when `misc.pull_directory()` fails because of `tar`. the failures for the test are. Signed-off-by: Kefu Chai (cherry picked from commit d67b0f1e3ac12d2b38ab6455b5311bcb051acb05) --- qa/tasks/cephadm.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 01fe4e800e7ac..0c01b836e9ea7 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -250,8 +250,11 @@ def ceph_log(ctx, config): os.makedirs(sub) except OSError: pass - teuthology.pull_directory(remote, '/var/log/ceph', # everything - os.path.join(sub, 'log')) + try: + teuthology.pull_directory(remote, '/var/log/ceph', # everything + os.path.join(sub, 'log')) + except ReadError: + pass @contextlib.contextmanager def ceph_crash(ctx, config): -- 2.39.5