From c6a4bba949772ffdc53a0bb938f0b0da541d4dde Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 16 Apr 2020 11:33:18 +0800 Subject: [PATCH] qa/tasks: do not cancel pending pg num changes on mimic mimic does not support auto split/merge, but we do test mimic-x on nautilus, which ends up with failures like: ceback (most recent call last): File "/home/teuthworker/src/git.ceph.com_git_teuthology_py2/teuthology/contextutil.py", line 34, in nested yield vars File "/home/teuthworker/src/git.ceph.com_ceph_nautilus/qa/tasks/ceph.py", line 1928, in task ctx.managers[config['cluster']].stop_pg_num_changes() File "/home/teuthworker/src/git.ceph.com_ceph_nautilus/qa/tasks/ceph_manager.py", line 1806, in stop_pg_num_changes if pool['pg_num'] != pool['pg_num_target']: KeyError: 'pg_num_target' so we need to skip this if 'pg_num_target' is not in pg_pool_t::dump(). this change is not cherry-picked from master, as we don't test mimic-x on master. Signed-off-by: Kefu Chai --- qa/tasks/ceph.py | 13 +++++++++++-- qa/tasks/ceph_manager.py | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index aa4c9620fdc5..3b4b054c84de 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -1211,9 +1211,18 @@ def osd_scrub_pgs(ctx, config): for _ in range(0, retries): stats = manager.get_pg_stats() unclean = [stat['pgid'] for stat in stats if 'active+clean' not in stat['state']] - split_merge = [] osd_dump = manager.get_osd_dump_json() - split_merge = [i['pool_name'] for i in osd_dump['pools'] if i['pg_num'] != i['pg_num_target']] + for pool in osd_dump['pools']: + pg_num_target = pool.get('pg_num_target') + if pg_num_target is None: + # mimic does not adjust pg num automatically + split_merge = False + break + elif pg_num_target != pool['pg_num']: + split_merge = True + break + else: + split_merge = False if not unclean and not split_merge: all_clean = True break diff --git a/qa/tasks/ceph_manager.py b/qa/tasks/ceph_manager.py index 2d9a1c95369c..a1aec64426b6 100644 --- a/qa/tasks/ceph_manager.py +++ b/qa/tasks/ceph_manager.py @@ -1803,6 +1803,9 @@ class CephManager: self.log('Canceling any pending splits or merges...') osd_dump = self.get_osd_dump_json() for pool in osd_dump['pools']: + if 'pg_num_target' not in pool: + # mimic does not adjust pg num automatically + continue if pool['pg_num'] != pool['pg_num_target']: self.log('Setting pool %s (%d) pg_num %d -> %d' % (pool['pool_name'], pool['pool'], -- 2.47.3