From b5ba155c174f68c95e4fc8dac02ce19013b4f64a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Aug 2011 13:23:58 -0700 Subject: [PATCH] Revert "fix get_clients" This reverts commit 83b6678e79904793bf31e82bbecad7bf16c1b2b5. The bug I was hitting was actually fxied by 06e3e69c293b20c0ce5df526fa923a979c1d8cfc. --- teuthology/misc.py | 19 ++++++++----------- teuthology/task/ceph.py | 2 -- teuthology/task/cfuse.py | 2 +- teuthology/task/kclient.py | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index c089e65149..031f89abcf 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -294,17 +294,14 @@ def write_secret_file(remote, role, filename): ], ) -# return id, remote dictionary for the clients listed in config -def get_clients(ctx, config): - clients = [] - crem = ctx.cluster.only(is_type('client')) - for client in config: - assert client.startswith('client.') - id = client[len('client.'):] - for remote, roles in crem.remotes.iteritems(): - if client in roles: - clients.append((id, remote)) - return clients +def get_clients(ctx, roles): + for role in roles: + assert isinstance(role, basestring) + PREFIX = 'client.' + assert role.startswith(PREFIX) + id_ = role[len(PREFIX):] + (remote,) = ctx.cluster.only(role).remotes.iterkeys() + yield (id_, remote) def get_user(): return getpass.getuser() + '@' + socket.gethostname() diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index b8cb60a8e4..ea6ceea289 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -391,11 +391,9 @@ def cluster(ctx, config): ) log.info('Setting up client nodes...') - clients = ctx.cluster.only(teuthology.is_type('client')) for remote, roles_for_host in clients.remotes.iteritems(): for id_ in teuthology.roles_of_type(roles_for_host, 'client'): - log.info('id %s remote %s' % (id_, remote)) remote.run( args=[ '/tmp/cephtest/enable-coredump', diff --git a/teuthology/task/cfuse.py b/teuthology/task/cfuse.py index 2615ad5cb9..96d0538f84 100644 --- a/teuthology/task/cfuse.py +++ b/teuthology/task/cfuse.py @@ -40,8 +40,8 @@ def task(ctx, config): if config is None: config = ['client.{id}'.format(id=id_) for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')] + clients = list(teuthology.get_clients(ctx=ctx, roles=config)) - clients = teuthology.get_clients(ctx=ctx, config=config) for id_, remote in clients: mnt = os.path.join('/tmp/cephtest', 'mnt.{id}'.format(id=id_)) log.info('Mounting cfuse client.{id} at {remote} {mnt}...'.format( diff --git a/teuthology/task/kclient.py b/teuthology/task/kclient.py index 5733f3905d..97ed0c83e6 100644 --- a/teuthology/task/kclient.py +++ b/teuthology/task/kclient.py @@ -38,8 +38,8 @@ def task(ctx, config): if config is None: config = ['client.{id}'.format(id=id_) for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')] + clients = list(teuthology.get_clients(ctx=ctx, roles=config)) - clients = teuthology.get_clients(ctx=ctx, config=config) for id_, remote in clients: mnt = os.path.join('/tmp/cephtest', 'mnt.{id}'.format(id=id_)) log.info('Mounting kclient client.{id} at {remote} {mnt}...'.format( -- 2.39.5