From: Zack Cerza Date: Thu, 19 Oct 2017 18:32:07 +0000 (-0600) Subject: ceph_ansible: Don't collect logs on non-Ceph hosts X-Git-Tag: 1.1.0~381^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e2a8c157161e2cfd56ef184367b75290227d1c4;p=teuthology.git ceph_ansible: Don't collect logs on non-Ceph hosts If a job uses machines for something other than to install Ceph, avoid attempting to collect Ceph logs - the job will fail. Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/ceph_ansible.py b/teuthology/task/ceph_ansible.py index dd5a04996..9c95bf80b 100644 --- a/teuthology/task/ceph_ansible.py +++ b/teuthology/task/ceph_ansible.py @@ -42,6 +42,15 @@ class CephAnsible(Task): * Set ``public_network`` for each host if ``public_network`` is unset """.format(git_base=teuth_config.ceph_git_base_url) + groups_to_roles = dict( + mons='mon', + mgrs='mgr', + mdss='mds', + osds='osd', + rgws='rgw', + clients='client', + ) + def __init__(self, ctx, config): super(CephAnsible, self).__init__(ctx, config) config = self.config or dict() @@ -114,17 +123,9 @@ class CephAnsible(Task): self.run_playbook() def generate_hosts_file(self): - groups_to_roles = dict( - mons='mon', - mgrs='mgr', - mdss='mds', - osds='osd', - rgws='rgw', - clients='client', - ) hosts_dict = dict() - for group in sorted(groups_to_roles.keys()): - role_prefix = groups_to_roles[group] + for group in sorted(self.groups_to_roles.keys()): + role_prefix = self.groups_to_roles[group] want = lambda role: role.startswith(role_prefix) for (remote, roles) in self.cluster.only(want).remotes.iteritems(): hostname = remote.hostname @@ -261,7 +262,15 @@ class CephAnsible(Task): log.info('Archiving logs...') path = os.path.join(ctx.archive, 'remote') os.makedirs(path) - for remote in ctx.cluster.remotes.iterkeys(): + + def wanted(role): + # Only attempt to collect logs from hosts which are part of the + # cluster + return any(map( + lambda role_stub: role.startswith(role_stub), + self.groups_to_roles.values(), + )) + for remote in ctx.cluster.only(wanted).remotes.keys(): sub = os.path.join(path, remote.shortname) os.makedirs(sub) misc.pull_directory(remote, '/var/log/ceph',