]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
fix get_clients
authorSage Weil <sage@newdream.net>
Thu, 4 Aug 2011 22:01:49 +0000 (15:01 -0700)
committerSage Weil <sage@newdream.net>
Fri, 5 Aug 2011 21:35:44 +0000 (14:35 -0700)
Only return the clients that are listed (not _all_ clients).  There might
be a combination of cfuse and kclient (or other) clients here!

teuthology/misc.py
teuthology/task/ceph.py
teuthology/task/cfuse.py
teuthology/task/kclient.py

index ccf79727f6162fa54961ceeeb44e802bc7906017..a7184b79e50975e08a4867415b3f358f2690168b 100644 (file)
@@ -294,14 +294,17 @@ def write_secret_file(remote, role, filename):
             ],
         )
 
-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)
+# 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_user():
     return getpass.getuser() + '@' + socket.gethostname()
index ea6ceea2892d991f6802123e559ba5a4e6314b69..b8cb60a8e45e496a8e9096c7c9b9f70b885b3d87 100644 (file)
@@ -391,9 +391,11 @@ 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',
index fec223e1075a3ff289d342182414d2b7cbe038f6..00298e1d37ab2e239d642e5a4bceb98944832430 100644 (file)
@@ -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_))
         remote.run(
index 38f13b4531b4c4e7fa749eac6d1d45f5537bc9f7..6257c6c1680a1773740ae05f871dbb75f60c2d39 100644 (file)
@@ -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:
         log.debug('Mounting client client.{id}...'.format(id=id_))
         remotes_and_roles = ctx.cluster.remotes.items()