qa: get rid of iterkeys for py3 compatibility

Fixes: https://tracker.ceph.com/issues/42287

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
This commit is contained in:
Kyr Shatskyy 2019-10-11 17:57:47 +02:00
parent 7f80f5de91
commit 5f95b532aa
60 changed files with 106 additions and 106 deletions

View File

@ -124,7 +124,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,) = ctx.cluster.only(client).remotes.keys()
socket_path = '/var/run/ceph/ceph-{name}.asok'.format(name=client)
overrides = ctx.config.get('overrides', {}).get('admin_socket', {})

View File

@ -42,17 +42,17 @@ def task(ctx, config):
log.info('Setting up autotest...')
testdir = teuthology.get_testdir(ctx)
with parallel() as p:
for role in config.iterkeys():
for role in config.keys():
(remote,) = ctx.cluster.only(role).remotes.keys()
p.spawn(_download, testdir, remote)
log.info('Making a separate scratch dir for every client...')
for role in config.iterkeys():
for role in config.keys():
assert isinstance(role, basestring)
PREFIX = 'client.'
assert role.startswith(PREFIX)
id_ = role[len(PREFIX):]
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
mnt = os.path.join(testdir, 'mnt.{id}'.format(id=id_))
scratch = os.path.join(mnt, 'client.{id}'.format(id=id_))
remote.run(

View File

@ -196,7 +196,7 @@ def run_barbican(ctx, config):
log.info('Running barbican...')
for (client, _) in config.items():
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
cluster_name, _, client_id = teuthology.split_role(client)
# start the public endpoint
@ -491,7 +491,7 @@ def task(ctx, config):
overrides = ctx.config.get('overrides', {})
# merge each client section, not the top level.
for client in config.iterkeys():
for client in config.keys():
if not config[client]:
config[client] = {}
teuthology.deep_merge(config[client], overrides.get('barbican', {}))

View File

@ -87,7 +87,7 @@ def ceph_crash(ctx, config):
os.makedirs(path)
except OSError as e:
pass
for remote in ctx.cluster.remotes.iterkeys():
for remote in ctx.cluster.remotes.keys():
sub = os.path.join(path, remote.shortname)
try:
os.makedirs(sub)
@ -197,7 +197,7 @@ def ceph_log(ctx, config):
conf += f.read().format(daemon_type=daemon, max_size=size)
f.seek(0, 0)
for remote in ctx.cluster.remotes.iterkeys():
for remote in ctx.cluster.remotes.keys():
teuthology.write_file(remote=remote,
path='{tdir}/logrotate.ceph-test.conf'.format(tdir=testdir),
data=StringIO(conf)
@ -272,7 +272,7 @@ def ceph_log(ctx, config):
os.makedirs(path)
except OSError as e:
pass
for remote in ctx.cluster.remotes.iterkeys():
for remote in ctx.cluster.remotes.keys():
sub = os.path.join(path, remote.shortname)
try:
os.makedirs(sub)
@ -308,7 +308,7 @@ def valgrind_post(ctx, config):
finally:
lookup_procs = list()
log.info('Checking for errors in any valgrind logs...')
for remote in ctx.cluster.remotes.iterkeys():
for remote in ctx.cluster.remotes.keys():
# look at valgrind logs for each node
proc = remote.run(
args=[
@ -358,7 +358,7 @@ def valgrind_post(ctx, config):
def crush_setup(ctx, config):
cluster_name = config['cluster']
first_mon = teuthology.get_first_mon(ctx, config, cluster_name)
(mon_remote,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon_remote,) = ctx.cluster.only(first_mon).remotes.keys()
profile = config.get('crush_tunables', 'default')
log.info('Setting crush tunables to %s', profile)
@ -372,7 +372,7 @@ def crush_setup(ctx, config):
def create_rbd_pool(ctx, config):
cluster_name = config['cluster']
first_mon = teuthology.get_first_mon(ctx, config, cluster_name)
(mon_remote,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon_remote,) = ctx.cluster.only(first_mon).remotes.keys()
log.info('Waiting for OSDs to come up')
teuthology.wait_until_osds_up(
ctx,
@ -401,7 +401,7 @@ def cephfs_setup(ctx, config):
coverage_dir = '{tdir}/archive/coverage'.format(tdir=testdir)
first_mon = teuthology.get_first_mon(ctx, config, cluster_name)
(mon_remote,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon_remote,) = ctx.cluster.only(first_mon).remotes.keys()
mdss = ctx.cluster.only(teuthology.is_type('mds', cluster_name))
# If there are any MDSs, then create a filesystem for them to use
# Do this last because requires mon cluster to be up and running
@ -770,7 +770,7 @@ def cluster(ctx, config):
path=monmap_path,
)
for rem in ctx.cluster.remotes.iterkeys():
for rem in ctx.cluster.remotes.keys():
# copy mon key and initial monmap
log.info('Sending monmap to node {remote}'.format(remote=rem))
teuthology.sudo_write_file(
@ -1923,7 +1923,7 @@ def task(ctx, config):
with contextutil.nested(*subtasks):
first_mon = teuthology.get_first_mon(ctx, config, config['cluster'])
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
if not hasattr(ctx, 'managers'):
ctx.managers = {}
ctx.managers[config['cluster']] = CephManager(

View File

@ -29,7 +29,7 @@ def download_ceph_deploy(ctx, config):
obtained from `python_version`, if specified.
"""
# use mon.a for ceph_admin
(ceph_admin,) = ctx.cluster.only('mon.a').remotes.iterkeys()
(ceph_admin,) = ctx.cluster.only('mon.a').remotes.keys()
try:
py_ver = str(config['python_version'])
@ -222,7 +222,7 @@ def build_ceph_cluster(ctx, config):
# puts it. Remember this here, because subsequently IDs will change from those in
# the test config to those that ceph-deploy invents.
(ceph_admin,) = ctx.cluster.only('mon.a').remotes.iterkeys()
(ceph_admin,) = ctx.cluster.only('mon.a').remotes.keys()
def execute_ceph_deploy(cmd):
"""Remotely execute a ceph_deploy command"""
@ -266,7 +266,7 @@ def build_ceph_cluster(ctx, config):
def ceph_volume_osd_create(ctx, config):
osds = ctx.cluster.only(teuthology.is_type('osd'))
no_of_osds = 0
for remote in osds.remotes.iterkeys():
for remote in osds.remotes.keys():
# all devs should be lvm
osd_create_cmd = './ceph-deploy osd create --debug ' + remote.shortname + ' '
# default is bluestore so we just need config item for filestore
@ -387,7 +387,7 @@ def build_ceph_cluster(ctx, config):
# install admin key on mons (ceph-create-keys doesn't do this any more)
mons = ctx.cluster.only(teuthology.is_type('mon'))
for remote in mons.remotes.iterkeys():
for remote in mons.remotes.keys():
execute_ceph_deploy('./ceph-deploy admin ' + remote.shortname)
# create osd's
@ -563,7 +563,7 @@ def build_ceph_cluster(ctx, config):
log.info('Archiving logs...')
path = os.path.join(ctx.archive, 'remote')
os.makedirs(path)
for remote in ctx.cluster.remotes.iterkeys():
for remote in ctx.cluster.remotes.keys():
sub = os.path.join(path, remote.shortname)
os.makedirs(sub)
teuthology.pull_directory(remote, '/var/log/ceph',
@ -786,7 +786,7 @@ def upgrade(ctx, config):
ceph_branch = '--dev={branch}'.format(branch=dev_branch)
# get the node used for initial deployment which is mon.a
mon_a = mapped_role.get('mon.a')
(ceph_admin,) = ctx.cluster.only(mon_a).remotes.iterkeys()
(ceph_admin,) = ctx.cluster.only(mon_a).remotes.keys()
testdir = teuthology.get_testdir(ctx)
cmd = './ceph-deploy install ' + ceph_branch
for role in roles:

View File

@ -279,7 +279,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False):
prefix = ("sudo ceph-objectstore-tool "
"--data-path {fpath} "
"--journal-path {jpath} ").format(fpath=FSPATH, jpath=JPATH)
for remote in osds.remotes.iterkeys():
for remote in osds.remotes.keys():
log.debug(remote)
log.debug(osds.remotes[remote])
for role in osds.remotes[remote]:
@ -319,7 +319,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False):
GETNAME = os.path.join(DATADIR, "get")
SETNAME = os.path.join(DATADIR, "set")
for remote in osds.remotes.iterkeys():
for remote in osds.remotes.keys():
for role in osds.remotes[remote]:
if string.find(role, "osd.") != 0:
continue
@ -411,7 +411,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False):
GETNAME = os.path.join(DATADIR, "get")
SETNAME = os.path.join(DATADIR, "set")
for remote in osds.remotes.iterkeys():
for remote in osds.remotes.keys():
for role in osds.remotes[remote]:
if string.find(role, "osd.") != 0:
continue
@ -498,7 +498,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False):
log.error(values)
log.info("Test pg info")
for remote in osds.remotes.iterkeys():
for remote in osds.remotes.keys():
for role in osds.remotes[remote]:
if string.find(role, "osd.") != 0:
continue
@ -523,7 +523,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False):
ERRORS += 1
log.info("Test pg logging")
for remote in osds.remotes.iterkeys():
for remote in osds.remotes.keys():
for role in osds.remotes[remote]:
if string.find(role, "osd.") != 0:
continue
@ -555,7 +555,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False):
log.info("Test pg export")
EXP_ERRORS = 0
for remote in osds.remotes.iterkeys():
for remote in osds.remotes.keys():
for role in osds.remotes[remote]:
if string.find(role, "osd.") != 0:
continue
@ -582,7 +582,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False):
log.info("Test pg removal")
RM_ERRORS = 0
for remote in osds.remotes.iterkeys():
for remote in osds.remotes.keys():
for role in osds.remotes[remote]:
if string.find(role, "osd.") != 0:
continue
@ -608,7 +608,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False):
if EXP_ERRORS == 0 and RM_ERRORS == 0:
log.info("Test pg import")
for remote in osds.remotes.iterkeys():
for remote in osds.remotes.keys():
for role in osds.remotes[remote]:
if string.find(role, "osd.") != 0:
continue

View File

@ -166,7 +166,7 @@ class CephCluster(object):
@property
def admin_remote(self):
first_mon = misc.get_first_mon(self._ctx, None)
(result,) = self._ctx.cluster.only(first_mon).remotes.iterkeys()
(result,) = self._ctx.cluster.only(first_mon).remotes.keys()
return result
def __init__(self, ctx):

View File

@ -61,7 +61,7 @@ def task(ctx, config):
try:
for client, tests in clients.iteritems():
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
client_dir = '{tdir}/archive/cram.{role}'.format(tdir=testdir, role=client)
remote.run(
args=[
@ -85,11 +85,11 @@ def task(ctx, config):
)
with parallel() as p:
for role in clients.iterkeys():
for role in clients.keys():
p.spawn(_run_tests, ctx, role)
finally:
for client, tests in clients.iteritems():
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
client_dir = '{tdir}/archive/cram.{role}'.format(tdir=testdir, role=client)
test_files = set([test.rsplit('/', 1)[1] for test in tests])
@ -128,7 +128,7 @@ def _run_tests(ctx, role):
PREFIX = 'client.'
assert role.startswith(PREFIX)
id_ = role[len(PREFIX):]
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
ceph_ref = ctx.summary.get('ceph-sha1', 'master')
testdir = teuthology.get_testdir(ctx)

View 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,) = ctx.cluster.only(first_mon).remotes.keys()
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,) = ctx.cluster.only('osd.%d' % i).remotes.keys()
p = osd_remote.run(
args = [ 'test', '-e', '{tdir}/err'.format(tdir=testdir) ],
wait=True,

View File

@ -61,7 +61,7 @@ def task(ctx, config):
log.info('writing initial objects')
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
# write 100 objects
for i in range(100):
rados(ctx, mon, ['-p', 'foo', 'put', 'existing_%d' % i, dummyfile])

View File

@ -64,7 +64,7 @@ def task(ctx, config):
log.info('writing initial objects')
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
# write 100 objects
for i in range(100):
rados(ctx, mon, ['-p', 'foo', 'put', 'existing_%d' % i, dummyfile])
@ -146,7 +146,7 @@ def task(ctx, config):
# Export a pg
(exp_remote,) = ctx.\
cluster.only('osd.{o}'.format(o=divergent)).remotes.iterkeys()
cluster.only('osd.{o}'.format(o=divergent)).remotes.keys()
FSPATH = manager.get_filepath()
JPATH = os.path.join(FSPATH, "journal")
prefix = ("sudo adjust-ulimits ceph-objectstore-tool "

View File

@ -48,7 +48,7 @@ def task(ctx, config):
timeout = 60
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,

View File

@ -21,7 +21,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,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,

View File

@ -47,7 +47,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,) = ctx.cluster.only(role).remotes.keys()
log.info('Running commands on role %s host %s', role, remote.name)
for c in ls:
c.replace('$TESTDIR', testdir)

View 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,) = ctx.cluster.only(client).remotes.keys()
testdir = teuthology.get_testdir(ctx)

View File

@ -106,7 +106,7 @@ def install_packages(ctx, config):
packages = {}
for (client, _) in config.items():
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
# use bindep to read which dependencies we need from keystone/bindep.txt
run_in_tox_venv(ctx, remote, ['pip', 'install', 'bindep'])
r = run_in_tox_venv(ctx, remote,
@ -122,7 +122,7 @@ def install_packages(ctx, config):
log.info('Removing packaged dependencies of Keystone...')
for (client, _) in config.items():
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
for dep in packages[client]:
remove_package(dep, remote)
@ -204,7 +204,7 @@ def run_keystone(ctx, config):
log.info('Configuring keystone...')
for (client, _) in config.items():
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
cluster_name, _, client_id = teuthology.split_role(client)
# start the public endpoint

View File

@ -22,7 +22,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,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,

View File

@ -39,7 +39,7 @@ 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, ) = ctx.cluster.only('client.{id}'.format(id=role)).remotes.keys()
creator_remotes.append((creator_remote, 'client.{id}'.format(id=role)))
remaining_pools = poolnum

View File

@ -23,7 +23,7 @@ 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,) = ctx.cluster.only('mds.{_id}'.format(_id=mds_id)).remotes.keys()
manager = ceph_manager.CephManager(
mds_remote, ctx=ctx, logger=log.getChild('ceph_manager'),
)

View File

@ -150,7 +150,7 @@ class MDSThrasher(Greenlet, Thrasher):
def kill_mds(self, mds):
if self.config.get('powercycle'):
(remote,) = (self.ctx.cluster.only('mds.{m}'.format(m=mds)).
remotes.iterkeys())
remotes.keys())
self.log('kill_mds on mds.{m} doing powercycle of {s}'.
format(m=mds, s=remote.name))
self._assert_ipmi(remote)
@ -171,7 +171,7 @@ class MDSThrasher(Greenlet, Thrasher):
"""
if self.config.get('powercycle'):
(remote,) = (self.ctx.cluster.only('mds.{m}'.format(m=mds)).
remotes.iterkeys())
remotes.keys())
self.log('revive_mds on mds.{m} doing powercycle of {s}'.
format(m=mds, s=remote.name))
self._assert_ipmi(remote)
@ -387,7 +387,7 @@ def task(ctx, config):
log.info('mds thrasher using random seed: {seed}'.format(seed=seed))
random.seed(seed)
(first,) = ctx.cluster.only('mds.{_id}'.format(_id=mdslist[0])).remotes.iterkeys()
(first,) = ctx.cluster.only('mds.{_id}'.format(_id=mdslist[0])).remotes.keys()
manager = ceph_manager.CephManager(
first, ctx=ctx, logger=log.getChild('ceph_manager'),
)

View File

@ -50,7 +50,7 @@ def task(ctx, config):
log.info('Beginning mon_clock_skew_check...')
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,
ctx=ctx,

View 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,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,

View File

@ -365,7 +365,7 @@ def task(ctx, config):
log.info('Beginning mon_thrash...')
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,
ctx=ctx,

View File

@ -238,10 +238,10 @@ def task(ctx, config):
if config.get('dst_client') is not None:
dst = config.get('dst_client')
(host,) = ctx.cluster.only(dst).remotes.iterkeys()
(host,) = ctx.cluster.only(dst).remotes.keys()
for role in config.get('clients', None):
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
ctx.netem.remote = remote
if config.get('delay', False):
static_delay(remote, host, config.get('iface'), config.get('delay'))
@ -267,6 +267,6 @@ def task(ctx, config):
if ctx.netem.names:
toggle.cleanup()
for role in config.get('clients'):
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
delete_dev(remote, config.get('iface'))

View File

@ -18,7 +18,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,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,

View 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,) = ctx.cluster.only(role).remotes.keys()
proc = remote.run(
args=[
"/bin/sh", "-c",

View 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,) = ctx.cluster.only(first_mon).remotes.keys()
num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
log.info('num_osds is %s' % num_osds)

View File

@ -54,7 +54,7 @@ def task(ctx, config):
log.info('1. Verify warning messages when exceeding nearfull_ratio')
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
proc = mon.run(
args=[

View 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,) = ctx.cluster.only(first_mon).remotes.keys()
num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
log.info('num_osds is %s' % num_osds)
@ -114,7 +114,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,) = ctx.cluster.only(first_mon).remotes.keys()
num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
log.info('num_osds is %s' % num_osds)

View File

@ -20,7 +20,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,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,

View File

@ -34,7 +34,7 @@ def task(ctx, config):
write_threads = config.get("write_threads", 10)
write_total_per_snap = config.get("write_total_per_snap", 1024*1024*30)
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
for poolid in range(num_pools):
poolname = "%s-%s" % (pool_prefix, str(poolid))

View File

@ -203,7 +203,7 @@ def generate_iso(ctx, config):
try:
yield
finally:
for client in config.iterkeys():
for client in config.keys():
(remote,) = ctx.cluster.only(client).remotes.keys()
remote.run(
args=[
@ -253,7 +253,7 @@ def download_image(ctx, config):
yield
finally:
log.debug('cleaning up base image files')
for client in config.iterkeys():
for client in config.keys():
base_file = '{tdir}/qemu/base.{client}.qcow2'.format(
tdir=testdir,
client=client,
@ -430,7 +430,7 @@ def run_qemu(ctx, config):
time.sleep(time_wait)
log.debug('checking that qemu tests succeeded...')
for client in config.iterkeys():
for client in config.keys():
(remote,) = ctx.cluster.only(client).remotes.keys()
# ensure we have permissions to all the logs

View File

@ -248,7 +248,7 @@ def task(ctx, config):
manager.raw_cluster_cmd(
'osd', 'pool', 'set', pool, 'min_size', str(min_size))
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
proc = remote.run(
args=["CEPH_CLIENT_ID={id_}".format(id_=id_)] + args +
["--pool", pool],

View File

@ -56,7 +56,7 @@ def task(ctx, config):
PREFIX = 'client.'
assert role.startswith(PREFIX)
id_ = role[len(PREFIX):]
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
if config.get('ec_pool', False):
profile = config.get('erasure_code_profile', {})

View File

@ -171,7 +171,7 @@ def run_radosbench(ctx, config, f, num_osds, size, replica, rep):
PREFIX = 'client.'
assert role.startswith(PREFIX)
id_ = role[len(PREFIX):]
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
proc = remote.run(
args=[
@ -217,5 +217,5 @@ def run_radosbench(ctx, config, f, num_osds, size, replica, rep):
def wait_until_healthy(ctx, config):
first_mon = teuthology.get_first_mon(ctx, config)
(mon_remote,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon_remote,) = ctx.cluster.only(first_mon).remotes.keys()
teuthology.wait_until_healthy(ctx, mon_remote)

View File

@ -326,7 +326,7 @@ def task(ctx, config):
overrides = ctx.config.get('overrides', {})
# merge each client section, not the top level.
for client in config.iterkeys():
for client in config.keys():
if not config[client]:
config[client] = {}
teuthology.deep_merge(config[client], overrides.get('ragweed', {}))

View File

@ -47,7 +47,7 @@ def _run_one_client(ctx, config, role):
krbd = config.get('krbd', False)
nbd = config.get('nbd', False)
testdir = teuthology.get_testdir(ctx)
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
args = []
if krbd or nbd:

View File

@ -200,7 +200,7 @@ def task(ctx, config):
'task only accepts a dict for configuration'
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
# stash a monmap for later
mon.run(args=['ceph', 'mon', 'getmap', '-o', '/tmp/monmap'])

View File

@ -76,7 +76,7 @@ def task(ctx, config):
log.info('writing initial objects')
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
# write 100 objects
for i in range(100):
rados(ctx, mon, ['-p', 'foo', 'put', 'existing_%d' % i, dummyfile])
@ -164,7 +164,7 @@ def task(ctx, config):
# Export a pg
(exp_remote,) = ctx.\
cluster.only('osd.{o}'.format(o=divergent)).remotes.iterkeys()
cluster.only('osd.{o}'.format(o=divergent)).remotes.keys()
FSPATH = manager.get_filepath()
JPATH = os.path.join(FSPATH, "journal")
prefix = ("sudo adjust-ulimits ceph-objectstore-tool "
@ -235,7 +235,7 @@ def task(ctx, config):
assert exit_status is 0
(remote,) = ctx.\
cluster.only('osd.{o}'.format(o=divergent)).remotes.iterkeys()
cluster.only('osd.{o}'.format(o=divergent)).remotes.keys()
cmd = 'rm {file}'.format(file=expfile)
remote.run(args=cmd, wait=True)
log.info("success")

View File

@ -22,7 +22,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,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,

View File

@ -124,7 +124,7 @@ def repair_test_2(ctx, manager, config, chooser):
log.info("starting repair test type 2")
victim_osd = chooser(manager, pool, 0)
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
# create object
log.info("doing put and setomapval")

View File

@ -51,7 +51,7 @@ def task(ctx, config):
log.info('writing initial objects')
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
(mon,) = ctx.cluster.only(first_mon).remotes.keys()
#create few objects
for i in range(100):
rados(ctx, mon, ['-p', 'foo', 'put', 'existing_%d' % i, dummyfile])

View 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,) = ctx.cluster.only(role).remotes.keys()
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])

View File

@ -41,7 +41,7 @@ def start_rgw(ctx, config, clients):
log.info('Starting rgw...')
testdir = teuthology.get_testdir(ctx)
for client in clients:
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
cluster_name, daemon_type, client_id = teuthology.split_role(client)
client_with_id = daemon_type + '.' + client_id
client_with_cluster = cluster_name + '.' + client_with_id
@ -196,7 +196,7 @@ def start_rgw(ctx, config, clients):
endpoint = ctx.rgw.role_endpoints[client]
url = endpoint.url()
log.info('Polling {client} until it starts accepting connections on {url}'.format(client=client, url=url))
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
wait_for_radosgw(url, remote)
try:
@ -257,7 +257,7 @@ def create_pools(ctx, clients):
log.info('Creating data pools')
for client in clients:
log.debug("Obtaining remote for client {}".format(client))
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
data_pool = 'default.rgw.buckets.data'
cluster_name, daemon_type, client_id = teuthology.split_role(client)

View File

@ -168,7 +168,7 @@ def configure(ctx, config):
s3tests_conf = config['s3tests_conf'][client]
if properties is not None and 'rgw_server' in properties:
host = None
for target, roles in zip(ctx.config['targets'].iterkeys(), ctx.config['roles']):
for target, roles in zip(ctx.config['targets'].keys(), ctx.config['roles']):
log.info('roles: ' + str(roles))
log.info('target: ' + str(target))
if properties['rgw_server'] in roles:
@ -307,7 +307,7 @@ def task(ctx, config):
overrides = ctx.config.get('overrides', {})
# merge each client section, not the top level.
for client in config.iterkeys():
for client in config.keys():
if not config[client]:
config[client] = {}
teuthology.deep_merge(config[client], overrides.get('s3readwrite', {}))

View File

@ -137,7 +137,7 @@ def configure(ctx, config):
s3tests_conf = config['s3tests_conf'][client]
if properties is not None and 'rgw_server' in properties:
host = None
for target, roles in zip(ctx.config['targets'].iterkeys(), ctx.config['roles']):
for target, roles in zip(ctx.config['targets'].keys(), ctx.config['roles']):
log.info('roles: ' + str(roles))
log.info('target: ' + str(target))
if properties['rgw_server'] in roles:

View File

@ -416,7 +416,7 @@ def task(ctx, config):
overrides = ctx.config.get('overrides', {})
# merge each client section, not the top level.
for client in config.iterkeys():
for client in config.keys():
if not config[client]:
config[client] = {}
teuthology.deep_merge(config[client], overrides.get('s3tests', {}))

View File

@ -26,7 +26,7 @@ def get_sambas(ctx, roles):
PREFIX = 'samba.'
assert role.startswith(PREFIX)
id_ = role[len(PREFIX):]
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
yield (id_, remote)

View 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,) = ctx.cluster.only(first_mon).remotes.keys()
manager = ceph_manager.CephManager(
mon,

View File

@ -31,7 +31,7 @@ def wait_for_victim_pg(manager):
def find_victim_object(ctx, pg, osd):
"""Return a file to be fuzzed"""
(osd_remote,) = ctx.cluster.only('osd.%d' % osd).remotes.iterkeys()
(osd_remote,) = ctx.cluster.only('osd.%d' % osd).remotes.keys()
data_path = os.path.join(
'/var/lib/ceph/osd',
'ceph-{id}'.format(id=osd),
@ -359,7 +359,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,) = ctx.cluster.only(first_mon).remotes.keys()
num_osds = teuthology.num_instances_of_type(ctx.cluster, 'osd')
log.info('num_osds is %s' % num_osds)

View File

@ -96,7 +96,7 @@ def create_users(ctx, config):
try:
yield
finally:
for client in config.iterkeys():
for client in config.keys():
for user in users.itervalues():
uid = '{user}.{client}'.format(user=user, client=client)
cluster_name, daemon_type, client_id = teuthology.split_role(client)

View File

@ -137,6 +137,6 @@ def task(ctx, config):
'grep', 'ceph'])
# wait for HEALTH_OK
mon = get_first_mon(ctx, config)
(mon_remote,) = ctx.cluster.only(mon).remotes.iterkeys()
(mon_remote,) = ctx.cluster.only(mon).remotes.keys()
wait_until_healthy(ctx, mon_remote, use_sudo=True)
yield

View File

@ -251,7 +251,7 @@ def task(ctx, config):
overrides = ctx.config.get('overrides', {})
# merge each client section, not the top level.
for client in config.iterkeys():
for client in config.keys():
if not config[client]:
config[client] = {}
teuthology.deep_merge(config[client], overrides.get('keystone', {}))

View File

@ -31,7 +31,7 @@ def rgwadmin(ctx, client, cmd, stdin=StringIO(), check_status=False,
]
pre.extend(cmd)
log.log(log_level, 'rgwadmin: cmd=%s' % pre)
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
proc = remote.run(
args=pre,
check_status=check_status,

View File

@ -63,8 +63,8 @@ def get_refspec_after_overrides(config, overrides):
overrides = copy.deepcopy(overrides.get('workunit', {}))
refspecs = {'suite_sha1': Refspec, 'suite_branch': Branch,
'sha1': Refspec, 'tag': Refspec, 'branch': Branch}
if any(map(lambda i: i in config, refspecs.iterkeys())):
for i in refspecs.iterkeys():
if any(map(lambda i: i in config, refspecs.keys())):
for i in refspecs.keys():
overrides.pop(i, None)
misc.deep_merge(config, overrides)

View File

@ -89,7 +89,7 @@ def run_vault(ctx, config):
assert isinstance(config, dict)
for (client, cconf) in config.items():
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
(remote,) = ctx.cluster.only(client).remotes.keys()
cluster_name, _, client_id = teuthology.split_role(client)
_, port = ctx.vault.endpoints[client]
@ -210,7 +210,7 @@ def task(ctx, config):
overrides = ctx.config.get('overrides', {})
# merge each client section, not the top level.
for client in config.iterkeys():
for client in config.keys():
if not config[client]:
config[client] = {}
teuthology.deep_merge(config[client], overrides.get('vault', {}))

View File

@ -44,7 +44,7 @@ def task(ctx, config):
assert isinstance(role, basestring)
PREFIX = 'client.'
assert role.startswith(PREFIX)
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
manager = ctx.managers['ceph']
manager.raw_cluster_cmd('osd', 'set', 'noout')

View File

@ -40,7 +40,7 @@ def task(ctx, config):
PREFIX = 'client.'
assert role.startswith(PREFIX)
id_ = role[len(PREFIX):]
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
(remote,) = ctx.cluster.only(role).remotes.keys()
remotes.append(remote)
args =['CEPH_CLIENT_ID={id_}'.format(id_=id_),

View File

@ -102,7 +102,7 @@ def task(ctx, config):
# Create scratch dirs for any non-all workunits
log.info('Making a separate scratch dir for every client...')
for role in clients.iterkeys():
for role in clients.keys():
assert isinstance(role, basestring)
if role == "all":
continue

View File

@ -307,7 +307,7 @@ def test_all():
print 'testing {m}/{c}'.format(m=module,c=cmd_cmd)
# test
for good_bad in perms.iterkeys():
for good_bad in perms.keys():
for (kind,lst) in perms[good_bad].iteritems():
for (perm,_) in lst:
cname = 'client.{gb}-{k}-{p}'.format(gb=good_bad,k=kind,p=perm)