From 548098668e6340947da175302364d4f5eb804b96 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 17 Oct 2019 22:07:18 +0800 Subject: [PATCH] qa/tasks/ceph_manager: do not panic of "pg_num_target" is missing we don't have "pg_num_target" in "osd dump" back in mimic, so we don't need to check it if it is missing when performing upgrade test. Signed-off-by: Kefu Chai --- qa/tasks/ceph.py | 6 +++++- qa/tasks/ceph_manager.py | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index 21713eed131a7..e6196f72252c5 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -1264,7 +1264,11 @@ def osd_scrub_pgs(ctx, config): 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']] + try: + split_merge = [i['pool_name'] for i in osd_dump['pools'] if i['pg_num'] != i['pg_num_target']] + except KeyError: + # we don't support pg_num_target before nautilus + pass 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 0d5691945cc55..cf9c92a9065ee 100644 --- a/qa/tasks/ceph_manager.py +++ b/qa/tasks/ceph_manager.py @@ -1896,14 +1896,18 @@ class CephManager: """ self.log('Canceling any pending splits or merges...') osd_dump = self.get_osd_dump_json() - for pool in osd_dump['pools']: - if pool['pg_num'] != pool['pg_num_target']: - self.log('Setting pool %s (%d) pg_num %d -> %d' % - (pool['pool_name'], pool['pool'], - pool['pg_num_target'], - pool['pg_num'])) - self.raw_cluster_cmd('osd', 'pool', 'set', pool['pool_name'], - 'pg_num', str(pool['pg_num'])) + try: + for pool in osd_dump['pools']: + if pool['pg_num'] != pool['pg_num_target']: + self.log('Setting pool %s (%d) pg_num %d -> %d' % + (pool['pool_name'], pool['pool'], + pool['pg_num_target'], + pool['pg_num'])) + self.raw_cluster_cmd('osd', 'pool', 'set', pool['pool_name'], + 'pg_num', str(pool['pg_num'])) + except KeyError: + # we don't support pg_num_target before nautilus + pass def set_pool_pgpnum(self, pool_name, force): """ -- 2.39.5