mirror of
https://github.com/ceph/ceph
synced 2025-03-30 15:31:01 +00:00
qa/tasks/ceph: do not print out empty list of pg
we could have following logging messages: tasks.ceph:Waiting for all PGs to be active+clean and split+merged, waiting on ['2.6', '2.5', '1.0', '2.4'] to go clean and/or [] to split/merge if the cluster has non-active+clean pgs when the "ceph" is about to end. but this message is a little bit confusing in the sense it lists "[]" in it. in this change, only PGs being waited are listed. also, added some cleanups: * use "else" to check if the loop is terminated by a break * remove "0" from the range() call Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
6ad3d0d63e
commit
735aa04105
@ -1188,8 +1188,7 @@ def osd_scrub_pgs(ctx, config):
|
||||
delays = 20
|
||||
cluster_name = config['cluster']
|
||||
manager = ctx.managers[cluster_name]
|
||||
all_clean = False
|
||||
for _ in range(0, retries):
|
||||
for _ in range(retries):
|
||||
stats = manager.get_pg_stats()
|
||||
unclean = [stat['pgid'] for stat in stats if 'active+clean' not in stat['state']]
|
||||
split_merge = []
|
||||
@ -1200,12 +1199,16 @@ def osd_scrub_pgs(ctx, config):
|
||||
# we don't support pg_num_target before nautilus
|
||||
pass
|
||||
if not unclean and not split_merge:
|
||||
all_clean = True
|
||||
break
|
||||
log.info(
|
||||
"Waiting for all PGs to be active+clean and split+merged, waiting on %s to go clean and/or %s to split/merge" % (unclean, split_merge))
|
||||
waiting_on = []
|
||||
if unclean:
|
||||
waiting_on.append(f'{unclean} to go clean')
|
||||
if split_merge:
|
||||
waiting_on.append(f'{split_merge} to split/merge')
|
||||
waiting_on = ' and '.join(waiting_on)
|
||||
log.info('Waiting for all PGs to be active+clean and split+merged, waiting on %s', waiting_on)
|
||||
time.sleep(delays)
|
||||
if not all_clean:
|
||||
else:
|
||||
raise RuntimeError("Scrubbing terminated -- not all pgs were active and clean.")
|
||||
check_time_now = time.localtime()
|
||||
time.sleep(1)
|
||||
|
Loading…
Reference in New Issue
Block a user