From: Josh Durgin Date: Fri, 25 Mar 2016 04:57:02 +0000 (-0700) Subject: tasks/ceph: make scrubbing cluster-aware X-Git-Tag: v11.1.1~58^2^2~212^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=96e7724e2360f86bf22e5a51de19659b74db9448;p=ceph.git tasks/ceph: make scrubbing cluster-aware Simplify implementation by using manager and teuthology.misc methods instead of reinventing them here. Signed-off-by: Josh Durgin --- diff --git a/tasks/ceph.py b/tasks/ceph.py index 40bd1d1ac04a..9ac7983d237a 100644 --- a/tasks/ceph.py +++ b/tasks/ceph.py @@ -932,21 +932,6 @@ def cluster(ctx, config): ) -def get_all_pg_info(rem_site, testdir): - """ - Get the results of a ceph pg dump - """ - info = rem_site.run(args=[ - 'sudo', - 'adjust-ulimits', - 'ceph-coverage', - '{tdir}/archive/coverage'.format(tdir=testdir), - 'ceph', 'pg', 'dump', - '--format', 'json'], stdout=StringIO()) - all_info = json.loads(info.stdout.getvalue()) - return all_info['pg_stats'] - - def osd_scrub_pgs(ctx, config): """ Scrub pgs when we exit. @@ -959,12 +944,11 @@ def osd_scrub_pgs(ctx, config): """ retries = 12 delays = 10 - vlist = ctx.cluster.remotes.values() - testdir = teuthology.get_testdir(ctx) - rem_site = ctx.cluster.remotes.keys()[0] + cluster_name = config['cluster'] + manager = ctx.managers[cluster_name] all_clean = False for _ in range(0, retries): - stats = get_all_pg_info(rem_site, testdir) + stats = manager.get_pg_stats() states = [stat['state'] for stat in stats] if len(set(states)) == 1 and states[0] == 'active+clean': all_clean = True @@ -976,21 +960,16 @@ def osd_scrub_pgs(ctx, config): return check_time_now = time.localtime() time.sleep(1) - for slists in vlist: - for role in slists: - if role.startswith('osd.'): - log.info("Scrubbing osd {osd}".format(osd=role)) - rem_site.run(args=[ - 'sudo', - 'adjust-ulimits', - 'ceph-coverage', - '{tdir}/archive/coverage'.format(tdir=testdir), - 'ceph', 'osd', 'deep-scrub', role]) + all_roles = teuthology.all_roles(ctx.cluster) + for role in teuthology.cluster_roles_of_type(all_roles, 'osd', cluster_name): + log.info("Scrubbing {osd}".format(osd=role)) + _, _, id_ = teuthology.split_role(role) + manager.raw_cluster_cmd('osd', 'deep-scrub', id_) prev_good = 0 gap_cnt = 0 loop = True while loop: - stats = get_all_pg_info(rem_site, testdir) + stats = manager.get_pg_stats() timez = [stat['last_scrub_stamp'] for stat in stats] loop = False thiscnt = 0