From: Sage Weil Date: Wed, 31 Aug 2011 20:56:42 +0000 (-0700) Subject: thrashosds: make it work when first mon isn't mon.0 X-Git-Tag: 1.1.0~2816 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c502418fca85ad0953ea864256e6a1ee3515bfd7;p=teuthology.git thrashosds: make it work when first mon isn't mon.0 --- diff --git a/teuthology/misc.py b/teuthology/misc.py index ffb4f59dc1..d6fd80bbc1 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -362,3 +362,16 @@ def read_config(ctx): g = yaml.safe_load_all(f) for new in g: ctx.teuthology_config.update(new) + +# return the "first" mon (alphanumerically, for lack of anything better) +def get_first_mon(ctx, config): + mons = [] + for remote, roles in ctx.cluster.remotes.items(): + for role in roles: + if not role.startswith('mon.'): + continue + mons.append(role) + break + firstmon = sorted(mons)[0] + assert firstmon + return firstmon diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 847aa07f23..0a611d3791 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -207,19 +207,6 @@ def binaries(ctx, config): ), ) -# return the "first" mon (alphanumerically, for lack of anything better) -def get_first_mon(ctx, config): - mons = [] - for remote, roles in ctx.cluster.remotes.items(): - for role in roles: - if not role.startswith('mon.'): - continue - mons.append(role) - break - firstmon = sorted(mons)[0] - assert firstmon - return firstmon - @contextlib.contextmanager def valgrind_post(ctx, config): try: @@ -294,7 +281,7 @@ def cluster(ctx, config): coverage_dir = '/tmp/cephtest/archive/coverage' - firstmon = get_first_mon(ctx, config) + firstmon = teuthology.get_first_mon(ctx, config) log.info('Setting up %s...' % firstmon) ctx.cluster.only(firstmon).run( @@ -710,7 +697,7 @@ def osd(ctx, config): @contextlib.contextmanager def mds(ctx, config): log.info('Starting mds daemons...') - firstmon = get_first_mon(ctx, config) + firstmon = teuthology.get_first_mon(ctx, config) mds_daemons = {} mdss = ctx.cluster.only(teuthology.is_type('mds')) coverage_dir = '/tmp/cephtest/archive/coverage' @@ -783,7 +770,7 @@ def mds(ctx, config): def healthy(ctx, config): log.info('Waiting until ceph is healthy...') - firstmon = get_first_mon(ctx, config) + firstmon = teuthology.get_first_mon(ctx, config) (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys() teuthology.wait_until_healthy( remote=mon0_remote, diff --git a/teuthology/task/thrashosds.py b/teuthology/task/thrashosds.py index 962a7ec959..4c76a5e981 100644 --- a/teuthology/task/thrashosds.py +++ b/teuthology/task/thrashosds.py @@ -1,6 +1,8 @@ import contextlib import logging import ceph_manager +from teuthology import misc as teuthology + log = logging.getLogger(__name__) @@ -49,7 +51,8 @@ def task(ctx, config): - interactive: """ log.info('Beginning thrashosds...') - (mon,) = ctx.cluster.only('mon.0').remotes.iterkeys() + first_mon = teuthology.get_first_mon(ctx, config) + (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys() manager = ceph_manager.CephManager( mon, logger=log.getChild('ceph_manager'),