]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Lines formerly of the form '(remote,) = ctx.cluster.only(role).remotes.keys()'
authorWarren Usui <warren.usui@inktank.com>
Sat, 1 Mar 2014 03:13:40 +0000 (19:13 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Thu, 27 Mar 2014 01:43:48 +0000 (18:43 -0700)
and '(remote,) = ctx.cluster.only(role).remotes.iterkeys()' would fail with
ValueError and no message if there were less than 0 or more than 1 key.
Now a new function, get_single_remote_value() is called which prints out
more understandable messages.

Fixes: 7510
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Warren Usui <warren.usui@inktank.com>
55 files changed:
teuthology/misc.py
teuthology/task/admin_socket.py
teuthology/task/autotest.py
teuthology/task/calamari.py
teuthology/task/ceph-deploy.py
teuthology/task/ceph.py
teuthology/task/ceph_manager.py
teuthology/task/common_fs_utils.py
teuthology/task/cram.py
teuthology/task/die_on_err.py
teuthology/task/divergent_priors.py
teuthology/task/dump_stuck.py
teuthology/task/exec.py
teuthology/task/filestore_idempotent.py
teuthology/task/install.py
teuthology/task/kernel.py
teuthology/task/lockfile.py
teuthology/task/lost_unfound.py
teuthology/task/manypools.py
teuthology/task/mds_creation_failure.py
teuthology/task/mds_thrash.py
teuthology/task/mon_clock_skew_check.py
teuthology/task/mon_recovery.py
teuthology/task/mon_thrash.py
teuthology/task/mpi.py
teuthology/task/object_source_down.py
teuthology/task/omapbench.py
teuthology/task/osd_backfill.py
teuthology/task/osd_failsafe_enospc.py
teuthology/task/osd_recovery.py
teuthology/task/peer.py
teuthology/task/peering_speed_test.py
teuthology/task/pexec.py
teuthology/task/qemu.py
teuthology/task/rados.py
teuthology/task/radosbench.py
teuthology/task/radosgw-admin-rest.py
teuthology/task/radosgw-agent.py
teuthology/task/rbd.py
teuthology/task/rbd_fsx.py
teuthology/task/recovery_bench.py
teuthology/task/repair_test.py
teuthology/task/restart.py
teuthology/task/rgw.py
teuthology/task/s3readwrite.py
teuthology/task/s3roundtrip.py
teuthology/task/s3tests.py
teuthology/task/samba.py
teuthology/task/scrub.py
teuthology/task/scrub_test.py
teuthology/task/swift.py
teuthology/task/thrashosds.py
teuthology/task/watch_notify_stress.py
teuthology/task/workunit.py
teuthology/task_util/rgw.py

index c075e56d6dd51b858fbd84d3a5689496383d6a33..49220ee41e4287beeb9991f7010ac8426d411a81 100644 (file)
@@ -987,7 +987,7 @@ def get_clients(ctx, roles):
         PREFIX = 'client.'
         assert role.startswith(PREFIX)
         id_ = role[len(PREFIX):]
-        (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+        remote = get_single_remote_value(ctx, role)
         yield (id_, remote)
 
 
@@ -1211,3 +1211,21 @@ def get_multi_machine_types(machinetype):
     if not machinetypes:
         machinetypes.append(machinetype)
     return machinetypes
+
+
+def get_single_remote_value(ctx, role):
+    """
+    Return the first (and hopefully only) remotes value for this role.
+    Added log.errors so that error conditions are not as confusing as
+    they used to be.  This code still throws a value error so that the
+    stack is dumped and the location of the fault can be found easily.
+    """
+    keyz = ctx.cluster.only(role).remotes.keys()
+    if len(keyz) == 0:
+        log.error("Role list for %s is empty" % role)
+    if len(keyz) > 1:
+        bad_keys = ", ".join(keyz)
+        log.error("Only one remote value should exist for %s -- %s found" %
+                role, bad_keys)
+    (remote,) = keyz
+    return remote
index 20a670122a9b68f0f17a4082170e15d587382218..4b01fae8c0afe569d8d91041915c0704d7afaaa4 100644 (file)
@@ -123,7 +123,7 @@ def _run_tests(ctx, client, tests):
     """
     testdir = teuthology.get_testdir(ctx)
     log.debug('Running admin socket tests on %s', client)
-    (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, client)
     socket_path = '/var/run/ceph/ceph-{name}.asok'.format(name=client)
     overrides = ctx.config.get('overrides', {}).get('admin_socket', {})
 
index 24a7675df277ff10f99271029f4edc114916375e..dde2950bfedbbd0370122096970a678c8ab294ef 100644 (file)
@@ -43,7 +43,7 @@ def task(ctx, config):
     testdir = teuthology.get_testdir(ctx)
     with parallel() as p:
         for role in config.iterkeys():
-            (remote,) = ctx.cluster.only(role).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             p.spawn(_download, testdir, remote)
 
     log.info('Making a separate scratch dir for every client...')
@@ -52,7 +52,7 @@ def task(ctx, config):
         PREFIX = 'client.'
         assert role.startswith(PREFIX)
         id_ = role[len(PREFIX):]
-        (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+        remote = teuthology.get_single_remote_value(ctx, role)
         mnt = os.path.join(testdir, 'mnt.{id}'.format(id=id_))
         scratch = os.path.join(mnt, 'client.{id}'.format(id=id_))
         remote.run(
@@ -69,7 +69,7 @@ def task(ctx, config):
 
     with parallel() as p:
         for role, tests in config.iteritems():
-            (remote,) = ctx.cluster.only(role).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             p.spawn(_run_tests, testdir, remote, role, tests)
 
 def _download(testdir, remote):
index f3c1495f699e59d18ac697496595d42518103470..b5b1d44ddd0e07de86e658d759892593a45e1972 100644 (file)
@@ -108,7 +108,7 @@ def _setup_calamari_cluster(remote, restapi_remote):
 
 
 def _remotes(ctx, selector):
-    return ctx.cluster.only(selector).remotes.keys()
+    return teuthology.get_single_remote_value(ctx, selector)
 
 """
 Tasks
index aec9d1b2c4327abbadfba9adcdc8ef3c4e0c33f7..3a676c0c5a3d2688fdd4a167cd6026752a27baf7 100644 (file)
@@ -65,7 +65,7 @@ def is_healthy(ctx, config):
     """Wait until a Ceph cluster is healthy."""
     testdir = teuthology.get_testdir(ctx)
     ceph_admin = teuthology.get_first_mon(ctx, config)
-    (remote,) = ctx.cluster.only(ceph_admin).remotes.keys()
+    remote = teuthology.get_single_remote_value(ctx, ceph_admin)
     max_tries = 90  # 90 tries * 10 secs --> 15 minutes
     tries = 0
     while True:
@@ -135,7 +135,7 @@ def execute_ceph_deploy(ctx, config, cmd):
     testdir = teuthology.get_testdir(ctx)
     ceph_admin = teuthology.get_first_mon(ctx, config)
     exec_cmd = cmd
-    (remote,) = ctx.cluster.only(ceph_admin).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, ceph_admin)
     proc = remote.run(
         args = [
             'cd',
@@ -190,7 +190,7 @@ def build_ceph_cluster(ctx, config):
         testdir = teuthology.get_testdir(ctx)
         conf_path = '{tdir}/ceph-deploy/ceph.conf'.format(tdir=testdir)
         first_mon = teuthology.get_first_mon(ctx, config)
-        (remote,) = ctx.cluster.only(first_mon).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, first_mon)
 
         lines = None
         if config.get('conf') is not None:
@@ -279,7 +279,7 @@ def build_ceph_cluster(ctx, config):
             conf_path = '/etc/ceph/ceph.conf'
             admin_keyring_path = '/etc/ceph/ceph.client.admin.keyring'
             first_mon = teuthology.get_first_mon(ctx, config)
-            (mon0_remote,) = ctx.cluster.only(first_mon).remotes.keys()
+            mon0_remote = teuthology.get_single_remote_value(ctx, first_mon)
             conf_data = teuthology.get_file(
                 remote=mon0_remote,
                 path=conf_path,
index 5a695b57081dc4fefb20eeac01ebbb9184e2385a..c1d7f6ed791eaaf6951d2eac8f4f4f6f06edb219 100644 (file)
@@ -565,7 +565,7 @@ def cluster(ctx, config):
             keyring_path,
             ],
         )
-    (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys()
+    mon0_remote = teuthology.get_single_remote_value(ctx, firstmon)
     fsid = teuthology.create_simple_monmap(
         ctx,
         remote=mon0_remote,
@@ -904,7 +904,7 @@ def cluster(ctx, config):
         ctx.summary['success'] = False
         raise
     finally:
-        (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys()
+        mon0_remote = teuthology.get_single_remote_value(ctx, firstmon)
 
         log.info('Checking cluster log for badness...')
         def first_in_ceph_log(pattern, excludes):
@@ -1185,7 +1185,7 @@ def run_daemon(ctx, config, type_):
 
     if type_ == 'mds':
         firstmon = teuthology.get_first_mon(ctx, config)
-        (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys()
+        mon0_remote = teuthology.get_single_remote_value(ctx, firstmon)
 
         mon0_remote.run(args=[
             'adjust-ulimits',
@@ -1208,7 +1208,7 @@ def healthy(ctx, config):
     """
     log.info('Waiting until ceph is healthy...')
     firstmon = teuthology.get_first_mon(ctx, config)
-    (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys()
+    mon0_remote = teuthology.get_single_remote_value(ctx, firstmon)
     teuthology.wait_until_osds_up(
         ctx,
         cluster=ctx.cluster,
@@ -1228,7 +1228,7 @@ def wait_for_osds_up(ctx, config):
     """
     log.info('Waiting until ceph osds are all up...')
     firstmon = teuthology.get_first_mon(ctx, config)
-    (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys()
+    mon0_remote = teuthology.get_single_remote_value(ctx, firstmon)
     teuthology.wait_until_osds_up(
         ctx,
         cluster=ctx.cluster,
@@ -1245,7 +1245,7 @@ def wait_for_mon_quorum(ctx, config):
 
     assert isinstance(config, list)
     firstmon = teuthology.get_first_mon(ctx, config)
-    (remote,) = ctx.cluster.only(firstmon).remotes.keys()
+    remote = teuthology.get_single_remote_value(ctx, firstmon)
     while True:
         r = remote.run(
             args=[
index 3952950b2d2ed7c1efab13157d44fbee5b63317c..c1973852fc6b69ccbf5414a346928688cedac6a0 100644 (file)
@@ -1190,7 +1190,8 @@ class CephManager:
         or by stopping.
         """
         if self.config.get('powercycle'):
-            (remote,) = self.ctx.cluster.only('osd.{o}'.format(o=osd)).remotes.iterkeys()
+            remote = teuthology.get_single_remotes_value(self.ctx,
+                    'osd.{o}'.format(o=osd))
             self.log('kill_osd on osd.{o} doing powercycle of {s}'.format(o=osd, s=remote.name))
             assert remote.console is not None, "powercycling requested but RemoteConsole is not initialized.  Check ipmi config."
             remote.console.power_off()
@@ -1212,7 +1213,8 @@ class CephManager:
         or by restarting.
         """
         if self.config.get('powercycle'):
-            (remote,) = self.ctx.cluster.only('osd.{o}'.format(o=osd)).remotes.iterkeys()
+            remote = teuthology.get_single_remotes_value(self.ctx,
+                    'osd.{o}'.format(o=osd))
             self.log('kill_osd on osd.{o} doing powercycle of {s}'.format(o=osd, s=remote.name))
             assert remote.console is not None, "powercycling requested but RemoteConsole is not initialized.  Check ipmi config."
             remote.console.power_on()
@@ -1258,7 +1260,8 @@ class CephManager:
         or by doing a stop.
         """
         if self.config.get('powercycle'):
-            (remote,) = self.ctx.cluster.only('mon.{m}'.format(m=mon)).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(self.ctx,
+                    'mon.{m}'.format(m=mon))
             self.log('kill_mon on mon.{m} doing powercycle of {s}'.format(m=mon, s=remote.name))
             assert remote.console is not None, "powercycling requested but RemoteConsole is not initialized.  Check ipmi config."
             remote.console.power_off()
@@ -1271,7 +1274,8 @@ class CephManager:
         or by doing a normal restart.
         """
         if self.config.get('powercycle'):
-            (remote,) = self.ctx.cluster.only('mon.{m}'.format(m=mon)).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(self.ctx,
+                    'mon.{m}'.format(m=mon))
             self.log('revive_mon on mon.{m} doing powercycle of {s}'.format(m=mon, s=remote.name))
             assert remote.console is not None, "powercycling requested but RemoteConsole is not initialized.  Check ipmi config."
             remote.console.power_on()
@@ -1324,7 +1328,8 @@ class CephManager:
         Powercyle if set in config, otherwise just stop.
         """
         if self.config.get('powercycle'):
-            (remote,) = self.ctx.cluster.only('mds.{m}'.format(m=mds)).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(self.ctx,
+                    'mds.{m}'.format(m=mds))
             self.log('kill_mds on mds.{m} doing powercycle of {s}'.format(m=mds, s=remote.name))
             assert remote.console is not None, "powercycling requested but RemoteConsole is not initialized.  Check ipmi config."
             remote.console.power_off()
@@ -1344,7 +1349,8 @@ class CephManager:
         and then restart (using --hot-standby if specified.
         """
         if self.config.get('powercycle'):
-            (remote,) = self.ctx.cluster.only('mds.{m}'.format(m=mds)).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(self.ctx,
+                    'mds.{m}'.format(m=mds))
             self.log('revive_mds on mds.{m} doing powercycle of {s}'.format(m=mds, s=remote.name))
             assert remote.console is not None, "powercycling requested but RemoteConsole is not initialized.  Check ipmi config."
             remote.console.power_on()
index b963e98d429a105476d8b5b9fec230eb9acea86a..3c79a26429781ac275c9045ace990359c593089e 100644 (file)
@@ -40,7 +40,7 @@ def generic_mkfs(ctx, config, devname_rtn):
     for role, properties in images:
         if properties is None:
             properties = {}
-        (remote,) = ctx.cluster.only(role).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, role)
         image = properties.get('image_name', default_image_name(role))
         fs_type = properties.get('fs_type', 'ext3')
         remote.run(
@@ -90,7 +90,7 @@ def generic_mount(ctx, config, devname_rtn):
     for role, image in role_images:
         if image is None:
             image = default_image_name(role)
-        (remote,) = ctx.cluster.only(role).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, role)
         id_ = strip_client_prefix(role)
         mnt = mnt_template.format(tdir=testdir, id=id_)
         mounted.append((remote, mnt))
index 05824d26ab0e6bd60bf0442d4edd740d7ac8acaa..8627e02a67465f42ec87d9c4d72b63ba95725175 100644 (file)
@@ -51,7 +51,7 @@ def task(ctx, config):
 
     try:
         for client, tests in clients.iteritems():
-            (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(ctx, client)
             client_dir = '{tdir}/archive/cram.{role}'.format(tdir=testdir, role=client)
             remote.run(
                 args=[
@@ -77,7 +77,7 @@ def task(ctx, config):
                 p.spawn(_run_tests, ctx, role)
     finally:
         for client, tests in clients.iteritems():
-            (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(ctx, client)
             client_dir = '{tdir}/archive/cram.{role}'.format(tdir=testdir, role=client)
             test_files = set([test.rsplit('/', 1)[1] for test in tests])
 
@@ -115,7 +115,7 @@ def _run_tests(ctx, role):
     PREFIX = 'client.'
     assert role.startswith(PREFIX)
     id_ = role[len(PREFIX):]
-    (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, role)
     ceph_ref = ctx.summary.get('ceph-sha1', 'master')
 
     testdir = teuthology.get_testdir(ctx)
index 1dfd37073628de17a321061bac832c975820e63b..c1c198f8f78074189783e1001c31dfab73b40151 100644 (file)
@@ -20,7 +20,7 @@ def task(ctx, config):
         config = {}
 
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
     log.info('num_osds is %s' % num_osds)
@@ -38,7 +38,7 @@ def task(ctx, config):
 
     while True:
         for i in range(num_osds):
-            (osd_remote,) = ctx.cluster.only('osd.%d' % i).remotes.iterkeys()
+            osd_remote = teuthology.get_single_remote_value(ctx, 'osd.%d' % i)
             p = osd_remote.run(
                 args = [ 'test', '-e', '{tdir}/err'.format(tdir=testdir) ],
                 wait=True,
index 432614f233cb1f879209b097e1cca1c4b2357c79..9767a02b124b1b3d8c97eb81e368291c8e40f9f2 100644 (file)
@@ -25,7 +25,7 @@ def task(ctx, config):
     assert isinstance(config, dict), \
         'divergent_priors task only accepts a dict for configuration'
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     manager = ceph_manager.CephManager(
         mon,
index 9e1780f01565a51223ed53cd0e8a9467fe9b4d0e..0b41021eee9277f746b4171993471cee131ee304 100644 (file)
@@ -57,7 +57,7 @@ def task(ctx, config):
 
     timeout = 60
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     manager = ceph_manager.CephManager(
         mon,
index f951f77a8a379a2e7c798484d97c6a2e12562155..af67eb9d15f9986647ee98828cabb29c10e2a60f 100644 (file)
@@ -34,7 +34,7 @@ def task(ctx, config):
         config = dict((id_, a) for id_ in roles)
 
     for role, ls in config.iteritems():
-        (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+        remote = teuthology.get_single_remote_value(ctx, role)
         log.info('Running commands on role %s host %s', role, remote.name)
         for c in ls:
             c.replace('$TESTDIR', testdir)
index d33ad6458413b1f2784298d5d98b376666bece2e..3621fd4cf0857737246429878fc39580c6e68454 100644 (file)
@@ -32,7 +32,7 @@ def task(ctx, config):
 
     # just use the first client...
     client = clients[0];
-    (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, client)
 
     testdir = teuthology.get_testdir(ctx)
 
index eaf8de9d5bde6f9dc2daf2492d3e8bc52144b7b5..6459a2834da272ea7953d33b8e881769e0aa1974 100644 (file)
@@ -1049,7 +1049,7 @@ def upgrade(ctx, config):
             remotes[remote] = config.get('all')
     else:
         for role in config.keys():
-            (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             if remote in remotes:
                 log.warn('remote %s came up twice (role %s)', remote, role)
                 continue
index 7d63190dcc04f291fba2a22e57d2395fe4f817e8..b9b0acb40968d71100476fb86a0df0ecad8ca61e 100644 (file)
@@ -189,7 +189,7 @@ def install_firmware(ctx, config):
         if config[role].find('distro') >= 0:
             log.info('Skipping firmware on distro kernel');
             return
-        (role_remote,) = ctx.cluster.only(role).remotes.keys()
+        role_remote = teuthology.get_single_remote_value(ctx, role)
         log.info('Installing linux-firmware on {role}...'.format(role=role))
         role_remote.run(
             args=[
@@ -239,7 +239,7 @@ def download_deb(ctx, config):
     procs = {}
     #Don't need to download distro kernels
     for role, src in config.iteritems():
-        (role_remote,) = ctx.cluster.only(role).remotes.keys()
+        role_remote = teuthology.get_single_remote_value(ctx, role)
        if src.find('distro') >= 0:
             log.info('Installing newest kernel distro');
             return
@@ -331,7 +331,7 @@ def install_and_reboot(ctx, config):
     procs = {}
     kernel_title = ''
     for role, src in config.iteritems():
-        (role_remote,) = ctx.cluster.only(role).remotes.keys()
+        role_remote = teuthology.get_single_remote_value(ctx, role)
         if src.find('distro') >= 0:
             log.info('Installing distro kernel on {role}...'.format(role=role))
             install_distro_kernel(role_remote)
@@ -480,7 +480,7 @@ def enable_disable_kdb(ctx, config):
     :param config: Configuration
     """
     for role, enable in config.iteritems():
-        (role_remote,) = ctx.cluster.only(role).remotes.keys()
+        role_remote = teuthology.get_single_remote_value(ctx, role)
         if "mira" in role_remote.name:
             serialdev = "ttyS2"
         else:
@@ -552,7 +552,7 @@ def need_to_install_distro(ctx, role):
     and compares against current (uname -r) and returns true if newest != current.
     Similar check for deb.
     """
-    (role_remote,) = ctx.cluster.only(role).remotes.keys()
+    role_remote = teuthology.get_single_remote_value(ctx, role)
     system_type = teuthology.get_system_type(role_remote)
     output, err_mess = StringIO(), StringIO()
     role_remote.run(args=['uname', '-r' ], stdout=output, stderr=err_mess )
index 10ac1e8e91b29921ebbe37934b7ad0d124036b27..68144d0031904d44dc2d9f207663a2195730a351 100644 (file)
@@ -78,7 +78,7 @@ def task(ctx, config):
         files = set(files)
         lock_procs = list()
         for client in clients:
-            (client_remote,) = ctx.cluster.only(client).remotes.iterkeys()
+            client_remote = teuthology.get_single_remote_value(ctx, client)
             log.info("got a client remote")
             (_, _, client_id) = client.partition('.')
             filepath = os.path.join(testdir, 'mnt.{id}'.format(id=client_id), op["lockfile"])
@@ -111,7 +111,7 @@ def task(ctx, config):
         # create the files to run these locks on
         client = clients.pop()
         clients.add(client)
-        (client_remote,) = ctx.cluster.only(client).remotes.iterkeys()
+        client_remote = teuthology.get_single_remote_value(ctx, client)
         (_, _, client_id) = client.partition('.')
         file_procs = list()
         for lockfile in files:
@@ -168,7 +168,7 @@ def task(ctx, config):
                 greenlet.kill(block=True)
 
         for client in clients:
-            (client_remote,)  = ctx.cluster.only(client).remotes.iterkeys()
+            client_remote  = teuthology.get_single_remote_value(ctx, client)
             (_, _, client_id) = client.partition('.')
             filepath = os.path.join(testdir, 'mnt.{id}'.format(id=client_id), op["lockfile"])
             proc = client_remote.run(
@@ -190,7 +190,7 @@ def lock_one(op, ctx):
     timeout = None
     proc = None
     result = None
-    (client_remote,)  = ctx.cluster.only(op['client']).remotes.iterkeys()
+    client_remote  = teuthology.get_single_remote_value(ctx, op['client'])
     (_, _, client_id) = op['client'].partition('.')
     testdir = teuthology.get_testdir(ctx)
     filepath = os.path.join(testdir, 'mnt.{id}'.format(id=client_id), op["lockfile"])
index 700a300bf033e1d2eea488b511470cd40ad9b1e2..379e759065b86c00b75fdc73f1bddf6823cd7483 100644 (file)
@@ -19,7 +19,7 @@ def task(ctx, config):
     assert isinstance(config, dict), \
         'lost_unfound task only accepts a dict for configuration'
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     manager = ceph_manager.CephManager(
         mon,
index 32b9d562bf46aff261877eb35cd031b0088b42c0..699c41ae927ac3993da2a148bfdf79c60a66f83e 100644 (file)
@@ -39,7 +39,8 @@ def task(ctx, config):
     log.info('got client_roles={client_roles_}'.format(client_roles_=client_roles))
     for role in client_roles:
         log.info('role={role_}'.format(role_=role))
-        (creator_remote, ) = ctx.cluster.only('client.{id}'.format(id=role)).remotes.iterkeys()
+        creator_remote = teuthology.get_single_remote_value(ctx,
+                'client.{id}'.format(id=role))
         creator_remotes.append((creator_remote, 'client.{id}'.format(id=role)))
 
     remaining_pools = poolnum
index a3d052fb95cdf0e30054fe9aee132a1618aadf3d..b2ba6b34277c2a210aab7bf8807c0ac8bdd3b4f3 100644 (file)
@@ -23,7 +23,8 @@ def task(ctx, config):
         raise RuntimeError("This task requires exactly one MDS")
 
     mds_id = mdslist[0]
-    (mds_remote,) = ctx.cluster.only('mds.{_id}'.format(_id=mds_id)).remotes.iterkeys()
+    mds_remote = misc.get_single_remote_value(ctx,
+            'mds.{_id}'.format(_id=mds_id))
     manager = ceph_manager.CephManager(
         mds_remote, ctx=ctx, logger=log.getChild('ceph_manager'),
     )
index c60b741a49e12c936d77917c9264f58354ebda8f..54f9a545e0dffc2f3ce553006be389df93877892 100644 (file)
@@ -276,7 +276,8 @@ def task(ctx, config):
     max_thrashers = config.get('max_thrash', 1)
     thrashers = {}
 
-    (first,) = ctx.cluster.only('mds.{_id}'.format(_id=mdslist[0])).remotes.iterkeys()
+    first = teuthology.get_single_remote_value(ctx,
+            'mds.{_id}'.format(_id=mdslist[0]))
     manager = ceph_manager.CephManager(
         first, ctx=ctx, logger=log.getChild('ceph_manager'),
     )
index 891e6ec484ede7c5f7c2b4480a6be2678e4e32a4..e71f75fe8af18902a67e56edc7c454c873d35a4a 100644 (file)
@@ -240,7 +240,7 @@ def task(ctx, config):
         'mon_clock_skew_check task only accepts a dict for configuration'
     log.info('Beginning mon_clock_skew_check...')
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
     manager = ceph_manager.CephManager(
         mon,
         ctx=ctx,
index bfa2cdf78f15dfe348dc7d4f2aaf3d345847d050..a593f262c797918c2b49c7fa81a500e04c71d2b2 100644 (file)
@@ -17,7 +17,7 @@ def task(ctx, config):
     assert isinstance(config, dict), \
         'task only accepts a dict for configuration'
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     manager = ceph_manager.CephManager(
         mon,
index 7dc7caad8463d6e9ba6d8d806c202ac092091a7f..c75d20bb95d6e7f6478ad5dfffe3a99e7cee9b68 100644 (file)
@@ -324,7 +324,7 @@ def task(ctx, config):
         'mon_thrash task requires at least 3 monitors'
     log.info('Beginning mon_thrash...')
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
     manager = ceph_manager.CephManager(
         mon,
         ctx=ctx,
index 6d2381ee58e09a28b5425dd061db36314403f07a..22d048c85b3b50d861fc29286c5895b9b86ed792 100644 (file)
@@ -70,23 +70,25 @@ def task(ctx, config):
     if 'nodes' in config:
         if isinstance(config['nodes'], basestring) and config['nodes'] == 'all':
             for role in  teuthology.all_roles(ctx.cluster):
-                (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+                remote = teuthology.get_single_remote_value(ctx,role)
                 ip,port = remote.ssh.get_transport().getpeername()
                 hosts.append(ip)
                 remotes.append(remote)
-            (master_remote,) = ctx.cluster.only(config['nodes'][0]).remotes.iterkeys()
+            master_remote = teuthology.get_single_remote_value(ctx,
+                    config['nodes'][0])
         elif isinstance(config['nodes'], list):
             for role in config['nodes']:
-                (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+                remote = teuthology.get_single_remote_value(ctx, role)
                 ip,port = remote.ssh.get_transport().getpeername()
                 hosts.append(ip)
                 remotes.append(remote)
-            (master_remote,) = ctx.cluster.only(config['nodes'][0]).remotes.iterkeys()
+            master_remote = teuthology.get_single_remote_value(ctx,
+                    config['nodes'][0])
     else:
         roles = ['client.{id}'.format(id=id_) for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
-        (master_remote,) = ctx.cluster.only(roles[0]).remotes.iterkeys()
+        master_remote = teuthology.get_single_remote_value(ctx, roles[0])
         for role in roles:
-            (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             ip,port = remote.ssh.get_transport().getpeername()
             hosts.append(ip)
             remotes.append(remote)
index 1696c55214aacb54472a646f1cbc07676eed5845..26e936d18b08bb8c70e957b5a874a4cd8642d0c5 100644 (file)
@@ -17,7 +17,7 @@ def task(ctx, config):
     assert isinstance(config, dict), \
         'lost_unfound task only accepts a dict for configuration'
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     manager = ceph_manager.CephManager(
         mon,
index 7d2535453231aee9093820093fc79c97296fd23a..0d07c5d905059154c3aac72a94bedb2505b09eb6 100644 (file)
@@ -52,7 +52,7 @@ def task(ctx, config):
         PREFIX = 'client.'
         assert role.startswith(PREFIX)
         id_ = role[len(PREFIX):]
-        (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+        remote = teuthology.get_single_remote_value(ctx, role)
         proc = remote.run(
             args=[
                 "/bin/sh", "-c",
index d80ea22ef22484c95c754d5b28d87c5a586534f7..4c5ad7ad2a326612febab1d0fcdab1b8428ccd09 100644 (file)
@@ -38,7 +38,7 @@ def task(ctx, config):
     assert isinstance(config, dict), \
         'thrashosds task only accepts a dict for configuration'
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
     
     num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
     log.info('num_osds is %s' % num_osds)
index 39b5b5c530096c8a21b2cef75875e67caed1378a..cf33cadfbc59f0939f77cea985e239da3e9454ba 100644 (file)
@@ -32,7 +32,7 @@ def task(ctx, config):
     assert isinstance(config, dict), \
         'osd_failsafe_enospc task only accepts a dict for configuration'
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     manager = ceph_manager.CephManager(
         mon,
index 1ff17335b15e79fb3006e55214973f3f20b8afc2..f7c4b838c9f44407b044414eccb0e4cd6e16772a 100644 (file)
@@ -38,7 +38,7 @@ def task(ctx, config):
         'task only accepts a dict for configuration'
     testdir = teuthology.get_testdir(ctx)
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
     
     num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
     log.info('num_osds is %s' % num_osds)
@@ -119,7 +119,7 @@ def test_incomplete_pgs(ctx, config):
     assert isinstance(config, dict), \
         'task only accepts a dict for configuration'
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
     log.info('num_osds is %s' % num_osds)
index 8006c3812ad7a777e27f433d0c56e7a8d393be3e..9b233a75556f698d4bf0d627dd9cba3cd9602acd 100644 (file)
@@ -19,7 +19,7 @@ def task(ctx, config):
     assert isinstance(config, dict), \
         'peer task only accepts a dict for configuration'
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     manager = ceph_manager.CephManager(
         mon,
index 6c885f1c961b785dc84cd07f8db88605f8edcc1b..8db4a5dba784fd29802c319a527e5bb150cddb6e 100644 (file)
@@ -26,7 +26,7 @@ def setup(ctx, config):
     Setup peering test on remotes.
     """
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
     ctx.manager = ceph_manager.CephManager(
         mon,
         ctx=ctx,
index 742ac0010bc2228728775374f6f2925bc059e53f..02d84a1c0086e38c3485e0c5b7aeacac3c02dd9b 100644 (file)
@@ -68,15 +68,16 @@ def _generate_remotes(ctx, config):
     elif 'clients' in config:
         ls = config['clients']
         for role in teuthology.all_roles_of_type(ctx.cluster, 'client'):
-            (remote,) = ctx.cluster.only('client.{r}'.format(r=role)).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(ctx,
+                    'client.{r}'.format(r=role))
             yield (remote, ls)
         del config['clients']
         for role, ls in config.iteritems():
-            (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             yield (remote, ls)
     else:
         for role, ls in config.iteritems():
-            (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             yield (remote, ls)
 
 def task(ctx, config):
index db93107a9871aa276279a9875ab50b622fb1c847..423e04af80a428263e48a1e2d0bbb9b63c0c0948 100644 (file)
@@ -26,7 +26,7 @@ def create_dirs(ctx, config):
     testdir = teuthology.get_testdir(ctx)
     for client, client_config in config.iteritems():
         assert 'test' in client_config, 'You must specify a test to run'
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         remote.run(
             args=[
                 'install', '-d', '-m0755', '--',
@@ -39,7 +39,7 @@ def create_dirs(ctx, config):
     finally:
         for client, client_config in config.iteritems():
             assert 'test' in client_config, 'You must specify a test to run'
-            (remote,) = ctx.cluster.only(client).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, client)
             remote.run(
                 args=[
                     'rmdir', '{tdir}/qemu'.format(tdir=testdir), run.Raw('||'), 'true',
@@ -84,7 +84,7 @@ def generate_iso(ctx, config):
   /mnt/cdrom/test.sh > /mnt/log/test.log 2>&1 && touch /mnt/log/success
 """ + test_teardown
 
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         teuthology.write_file(remote, userdata_path, StringIO(user_data))
 
         with file(os.path.join(src_dir, 'metadata.yaml'), 'rb') as f:
@@ -114,7 +114,7 @@ def generate_iso(ctx, config):
         yield
     finally:
         for client in config.iterkeys():
-            (remote,) = ctx.cluster.only(client).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, client)
             remote.run(
                 args=[
                     'rm', '-f',
@@ -131,7 +131,7 @@ def download_image(ctx, config):
     log.info('downloading base image')
     testdir = teuthology.get_testdir(ctx)
     for client, client_config in config.iteritems():
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         base_file = '{tdir}/qemu/base.{client}.qcow2'.format(tdir=testdir, client=client)
         remote.run(
             args=[
@@ -147,7 +147,7 @@ def download_image(ctx, config):
                 tdir=testdir,
                 client=client,
                 )
-            (remote,) = ctx.cluster.only(client).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, client)
             remote.run(
                 args=[
                     'rm', '-f', base_file,
@@ -160,7 +160,7 @@ def run_qemu(ctx, config):
     procs = []
     testdir = teuthology.get_testdir(ctx)
     for client, client_config in config.iteritems():
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         log_dir = '{tdir}/archive/qemu/{client}'.format(tdir=testdir, client=client)
         remote.run(
             args=[
@@ -228,7 +228,7 @@ def run_qemu(ctx, config):
 
         log.debug('checking that qemu tests succeeded...')
         for client in config.iterkeys():
-            (remote,) = ctx.cluster.only(client).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, client)
             remote.run(
                 args=[
                     'test', '-f',
index 0897726a6bcf9f81437347b82bce95ce4ac1abda..ffb33b4c1aa8c6f4e577aff476c35609e61e22e4 100644 (file)
@@ -120,7 +120,7 @@ def task(ctx, config):
         """Thread spawned by gevent"""
         if not hasattr(ctx, 'manager'):
             first_mon = teuthology.get_first_mon(ctx, config)
-            (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+            mon = teuthology.get_single_remote_value(ctx, first_mon)
             ctx.manager = CephManager(
                 mon,
                 ctx=ctx,
@@ -147,7 +147,7 @@ def task(ctx, config):
                     pool = ctx.manager.create_pool_with_unique_name(ec_pool=config.get('ec_pool', False))
                     created_pools.append(pool)
 
-                (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+                remote = teuthology.get_single_remote_value(ctx, role)
                 proc = remote.run(
                     args=["CEPH_CLIENT_ID={id_}".format(id_=id_)] + args +
                     ["--pool", pool],
index d2e75716e9194a6014e29155460fe7e02805ace1..b3e4c8b0fdb9cec7a9c79092ce6d417fd5a57fe0 100644 (file)
@@ -44,7 +44,7 @@ def task(ctx, config):
         PREFIX = 'client.'
         assert role.startswith(PREFIX)
         id_ = role[len(PREFIX):]
-        (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+        remote = teuthology.get_single_remote_value(ctx, role)
 
         pool = 'data'
         if config.get('pool'):
index 43cf735394c4cb9705f96b4f6ec8259c1905eb3f..1d31f1dc567ca5bebabeae3a20832abd82bf096c 100644 (file)
@@ -53,7 +53,7 @@ def rgwadmin(ctx, client, cmd):
         '--format', 'json',
         ]
     pre.extend(cmd)
-    (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, client)
     proc = remote.run(
         args=pre,
         check_status=False,
@@ -217,7 +217,7 @@ def task(ctx, config):
     logging.error(err)
     assert not err
 
-    (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, client)
     remote_host = remote.name.split('@')[1]
     admin_conn = boto.s3.connection.S3Connection(
         aws_access_key_id=admin_access_key,
index 6d48e0df0510c7d787a7f701d2eaf4f9fecbf49c..ae0c4f87e7ff67e09a46775506887f0a56359295 100644 (file)
@@ -33,7 +33,7 @@ def run_radosgw_agent(ctx, config):
         log.info("dest is %s", dest_zone)
 
         testdir = teuthology.get_testdir(ctx)
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         # figure out which branch to pull from
         branch = cconf.get('force-branch', None)
         if not branch:
index 7d07a6115af24f1aca57834b957895c936892317..16a91f61e2a0453e22a58ece7227102817234b5a 100644 (file)
@@ -53,7 +53,7 @@ def create_image(ctx, config):
         name = properties.get('image_name', default_image_name(role))
         size = properties.get('image_size', 10240)
         fmt = properties.get('image_format', 1)
-        (remote,) = ctx.cluster.only(role).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, role)
         log.info('Creating image {name} with size {size}'.format(name=name,
                                                                  size=size))
         args = [
@@ -79,7 +79,7 @@ def create_image(ctx, config):
             if properties is None:
                 properties = {}
             name = properties.get('image_name', default_image_name(role))
-            (remote,) = ctx.cluster.only(role).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             remote.run(
                 args=[
                     'adjust-ulimits',
@@ -106,7 +106,7 @@ def modprobe(ctx, config):
     """
     log.info('Loading rbd kernel module...')
     for role in config:
-        (remote,) = ctx.cluster.only(role).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, role)
         remote.run(
             args=[
                 'sudo',
@@ -119,7 +119,7 @@ def modprobe(ctx, config):
     finally:
         log.info('Unloading rbd kernel module...')
         for role in config:
-            (remote,) = ctx.cluster.only(role).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             remote.run(
                 args=[
                     'sudo',
@@ -164,7 +164,7 @@ def dev_create(ctx, config):
     for role, image in role_images:
         if image is None:
             image = default_image_name(role)
-        (remote,) = ctx.cluster.only(role).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, role)
 
         remote.run(
             args=[
@@ -191,7 +191,7 @@ def dev_create(ctx, config):
         for role, image in role_images:
             if image is None:
                 image = default_image_name(role)
-            (remote,) = ctx.cluster.only(role).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             remote.run(
                 args=[
                     'LD_LIBRARY_PATH={tdir}/binary/usr/local/lib'.format(tdir=testdir),
@@ -287,7 +287,7 @@ def run_xfstests_one_client(ctx, role, properties):
         fs_type = properties.get('fs_type')
         tests = properties.get('tests')
 
-        (remote,) = ctx.cluster.only(role).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, role)
 
         # Fetch the test script
         test_root = teuthology.get_testdir(ctx)
index 6d55b5cf457596ef23900482fd6c1cac0784df44..8cb5101fec9d3e4be552f25213352fc1fa5df85e 100644 (file)
@@ -43,7 +43,7 @@ def task(ctx, config):
 def _run_one_client(ctx, config, role):
     """Spawned task that runs the client"""
     testdir = teuthology.get_testdir(ctx)
-    (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, role)
     remote.run(
         args=[
             'adjust-ulimits',
index 1984b97d31effc699846f2e2f44fa2bc7d6a306e..5c12bdbc9b9d5317dea30fb61a55dcd90bd4aa4f 100644 (file)
@@ -48,7 +48,7 @@ def task(ctx, config):
     log.info('Beginning recovery bench...')
 
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     manager = ceph_manager.CephManager(
         mon,
@@ -113,7 +113,8 @@ class RecoveryBencher:
         io_size = self.config.get("io_size", 4096)
 
         osd = str(random.choice(self.osds))
-        (osd_remote,) = self.ceph_manager.ctx.cluster.only('osd.%s' % osd).remotes.iterkeys()
+        osd_remote = teuthology.get_single_remote_value(self.ceph_manager.ctx,
+                'osd.%s' % osd)
 
         testdir = teuthology.get_testdir(self.ceph_manager.ctx)
 
index 1dd8f2fdefa6c04465d136225046b4f8cda40416..f1063a186dc20c5ba6dcc0b9ac47df26362476d1 100644 (file)
@@ -98,7 +98,7 @@ def gen_repair_test_2(chooser):
         log.info("starting repair test type 2")
         victim_osd = chooser(pool, 0)
         first_mon = teuthology.get_first_mon(ctx, config)
-        (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+        mon = teuthology.get_single_remote_value(ctx, first_mon)
 
         # create object
         log.info("doing put and setomapval")
@@ -191,7 +191,7 @@ def task(ctx, config):
 
     if not hasattr(ctx, 'manager'):
         first_mon = teuthology.get_first_mon(ctx, config)
-        (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+        mon = teuthology.get_single_remote_value(ctx, first_mon)
         ctx.manager = ceph_manager.CephManager(
             mon,
             ctx=ctx,
index 87ca2b099e32298ede9e6790b76d360566c71371..b508df0f16dca29e6de515dfd61250fe02fc5a9f 100644 (file)
@@ -98,7 +98,7 @@ def task(ctx, config):
         assert 'exec' in config, "config requires exec key with <role>: <command> entries"
         for role, task in config['exec'].iteritems():
             log.info('restart for role {r}'.format(r=role))
-            (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             srcdir, restarts = get_tests(ctx, config, role, remote, testdir)
             log.info('Running command on role %s host %s', role, remote.name)
             spec = '{spec}'.format(spec=task[0])
index 674683a636a54cd03cbea41768647c42a5c38cd5..18b89279c8a7f7a16c2cfbcf808a2bcaf59954a2 100644 (file)
@@ -78,7 +78,7 @@ def ship_config(ctx, config, role_endpoints):
     log.info('Shipping apache config and rgw.fcgi...')
     src = os.path.join(os.path.dirname(__file__), 'apache.conf.template')
     for client, conf in config.iteritems():
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         system_type = teuthology.get_system_type(remote)
         if not conf:
             conf = {}
@@ -152,7 +152,7 @@ def start_rgw(ctx, config):
     log.info('Starting rgw...')
     testdir = teuthology.get_testdir(ctx)
     for client in config.iterkeys():
-        (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+        remote = teuthology.get_single_remote_value(ctx, client)
 
         client_config = config.get(client)
         if client_config is None:
@@ -235,7 +235,7 @@ def start_apache(ctx, config):
     testdir = teuthology.get_testdir(ctx)
     apaches = {}
     for client in config.iterkeys():
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         system_type = teuthology.get_system_type(remote)
         if system_type == 'deb':
             apache_name = 'apache2'
@@ -471,7 +471,7 @@ def create_nonregion_pools(ctx, config, regions):
 
     log.info('creating data pools')
     for client in config.keys():
-        (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         data_pool = '.rgw.buckets'
         if ctx.rgw.ec_data_pool:
             create_ec_pool(remote, data_pool, client, 64)
@@ -516,7 +516,7 @@ def configure_regions_and_zones(ctx, config, regions, role_endpoints):
 
     # clear out the old defaults
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
     # removing these objects from .rgw.root and the per-zone root pools
     # may or may not matter
     rados(ctx, mon,
@@ -533,7 +533,7 @@ def configure_regions_and_zones(ctx, config, regions, role_endpoints):
                   cmd=['-p', zone_info['domain_root'],
                        'rm', 'zone_info.default'])
 
-            (remote,) = ctx.cluster.only(role).remotes.keys()
+            remote = teuthology.get_single_remote_value(ctx, role)
             for pool_info in zone_info['placement_pools']:
                 remote.run(args=['ceph', 'osd', 'pool', 'create',
                                  pool_info['val']['index_pool'], '64', '64'])
index 476015d76b59c7f8a032f057ee89dabc4dafcba3..4c29b1314d1508dbe19241e1f532a0efc6f3b37c 100644 (file)
@@ -182,7 +182,7 @@ def configure(ctx, config):
         s3tests_conf['s3'].setdefault('port', def_conf['port'])
         s3tests_conf['s3'].setdefault('is_secure', def_conf['is_secure'])
 
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         remote.run(
             args=[
                 'cd',
@@ -216,7 +216,7 @@ def run_tests(ctx, config):
     assert isinstance(config, dict)
     testdir = teuthology.get_testdir(ctx)
     for client, client_config in config.iteritems():
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         conf = teuthology.get_file(remote, '{tdir}/archive/s3readwrite.{client}.config.yaml'.format(tdir=testdir, client=client))
         args = [
                 '{tdir}/s3-tests/virtualenv/bin/s3tests-test-readwrite'.format(tdir=testdir),
index 5a7093d6f43044ef95d117416ee1825f3d38d521..38b5705d28e185df423075ccab98ef20cba224a7 100644 (file)
@@ -147,7 +147,7 @@ def configure(ctx, config):
         s3tests_conf['s3'].setdefault('port', def_conf['port'])
         s3tests_conf['s3'].setdefault('is_secure', def_conf['is_secure'])
 
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         remote.run(
             args=[
                 'cd',
@@ -181,7 +181,7 @@ def run_tests(ctx, config):
     assert isinstance(config, dict)
     testdir = teuthology.get_testdir(ctx)
     for client, client_config in config.iteritems():
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         conf = teuthology.get_file(remote, '{tdir}/archive/s3roundtrip.{client}.config.yaml'.format(tdir=testdir, client=client))
         args = [
                 '{tdir}/s3-tests/virtualenv/bin/s3tests-test-roundtrip'.format(tdir=testdir),
index abbacb9bfaa3a9cd1957f136067210f48aebe276..f2c2b072848656f97c91a5220aa702082bf5e4ce 100644 (file)
@@ -246,7 +246,7 @@ def configure(ctx, config):
         else:
             s3tests_conf['DEFAULT']['host'] = 'localhost'
 
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         remote.run(
             args=[
                 'cd',
index c2e6e6a21747b62de4bfa936b399b27f1dae9955..079120cd25d08da04447ac50dbca93f5e7819a6c 100644 (file)
@@ -23,7 +23,7 @@ def get_sambas(ctx, roles):
         PREFIX = 'samba.'
         assert role.startswith(PREFIX)
         id_ = role[len(PREFIX):]
-        (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+        remote = teuthology.get_single_remote_value(ctx, role)
         yield (id_, remote)
 
 @contextlib.contextmanager
index 7a25300a677dc8e38f53e7d577a26a2aacb4e80b..e7285dfe74d6d36e75c48bdb57aa6539a3f60cab 100644 (file)
@@ -39,7 +39,7 @@ def task(ctx, config):
     log.info('Beginning scrub...')
 
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
 
     manager = ceph_manager.CephManager(
         mon,
index 3443ae9f45e92500c9d789bd4fa32e243aa69919..f5249666b39d2148a0055652585d989286b657f0 100644 (file)
@@ -33,7 +33,7 @@ def task(ctx, config):
     assert isinstance(config, dict), \
         'scrub_test task only accepts a dict for configuration'
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
     
     num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
     log.info('num_osds is %s' % num_osds)
@@ -73,7 +73,7 @@ def task(ctx, config):
 
     log.info('messing with PG %s on osd %d' % (victim, osd))
 
-    (osd_remote,) = ctx.cluster.only('osd.%d' % osd).remotes.iterkeys()
+    osd_remote = teuthology.get_single_remote_value(ctx, 'osd.%d' % osd)
     data_path = os.path.join(
         '/var/lib/ceph/osd',
         'ceph-{id}'.format(id=osd),
index 6285eb6b1c510d69113063109ad75193d6a701f1..efc8587765923a600e61588abec47dfda6f04b68 100644 (file)
@@ -133,7 +133,7 @@ def configure(ctx, config):
             testswift_conf['func_test']['auth_host'] = 'localhost'
 
         log.info(client)
-        (remote,) = ctx.cluster.only(client).remotes.keys()
+        remote = teuthology.get_single_remote_value(ctx, client)
         remote.run(
             args=[
                 'cd',
index c5f26dcb740c81af586eae80432fe0bfe639db63..37ac037657423e8ce4ac45daa753524bdf92fe29 100644 (file)
@@ -152,7 +152,7 @@ def task(ctx, config):
 
     log.info('Beginning thrashosds...')
     first_mon = teuthology.get_first_mon(ctx, config)
-    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+    mon = teuthology.get_single_remote_value(ctx, first_mon)
     manager = ceph_manager.CephManager(
         mon,
         ctx=ctx,
index ab611c3dd4a70ae8d8bd4d17703a395e3ebf6b02..2402840e09e10c7b35357f148116f79251cb3f34 100644 (file)
@@ -6,6 +6,7 @@ import logging
 import proc_thrasher
 
 from ..orchestra import run
+from teuthology import misc as teuthology
 
 log = logging.getLogger(__name__)
 
@@ -40,7 +41,7 @@ def task(ctx, config):
         PREFIX = 'client.'
         assert role.startswith(PREFIX)
         id_ = role[len(PREFIX):]
-        (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+        remote = teuthology.get_single_remote_value(ctx, role)
         remotes.append(remote)
 
         args =['CEPH_CLIENT_ID={id_}'.format(id_=id_),
index b504eeb50c58d4a1273eeec6a101532139cace88..412d800e57bb6dfefc1be803f68a93f1d51a6e2e 100644 (file)
@@ -127,7 +127,7 @@ def _delete_dir(ctx, role):
     PREFIX = 'client.'
     testdir = teuthology.get_testdir(ctx)
     id_ = role[len(PREFIX):]
-    (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, role)
     mnt = os.path.join(testdir, 'mnt.{id}'.format(id=id_))
     # Is there any reason why this is not: join(mnt, role) ?
     client = os.path.join(mnt, 'client.{id}'.format(id=id_))
@@ -169,7 +169,7 @@ def _make_scratch_dir(ctx, role, subdir):
     PREFIX = 'client.'
     id_ = role[len(PREFIX):]
     log.debug("getting remote for {id} role {role_}".format(id=id_, role_=role))
-    (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, role)
     dir_owner = remote.shortname.split('@', 1)[0]
     mnt = os.path.join(teuthology.get_testdir(ctx), 'mnt.{id}'.format(id=id_))
     # if neither kclient nor ceph-fuse are required for a workunit,
@@ -240,7 +240,8 @@ def _spawn_on_all_clients(ctx, refspec, tests, env, subdir, timeout=None):
     client_generator = teuthology.all_roles_of_type(ctx.cluster, 'client')
     client_remotes = list()
     for client in client_generator:
-        (client_remote,) = ctx.cluster.only('client.{id}'.format(id=client)).remotes.iterkeys()
+        client_remote = teuthology.get_single_remote_value(ctx, 
+                'client.{id}'.format(id=client))
         client_remotes.append((client_remote, 'client.{id}'.format(id=client)))
         _make_scratch_dir(ctx, "client.{id}".format(id=client), subdir)
 
@@ -279,7 +280,7 @@ def _run_tests(ctx, refspec, role, tests, env, subdir=None, timeout=None):
     PREFIX = 'client.'
     assert role.startswith(PREFIX)
     id_ = role[len(PREFIX):]
-    (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, role)
     mnt = os.path.join(testdir, 'mnt.{id}'.format(id=id_))
     # subdir so we can remove and recreate this a lot without sudo
     if subdir is None:
index cbe3071fbe5f4bfac3fd040f4a13a08f084f1dfd..7650c4cdfa531327c538c740978807dbac6ebfa4 100644 (file)
@@ -29,7 +29,7 @@ def rgwadmin(ctx, client, cmd, stdin=StringIO(), check_status=False):
         ]
     pre.extend(cmd)
     log.info('rgwadmin: cmd=%s' % pre)
-    (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+    remote = teuthology.get_single_remote_value(ctx, client)
     proc = remote.run(
         args=pre,
         check_status=check_status,