]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks/ceph: do not print out empty list of pg
authorKefu Chai <kchai@redhat.com>
Wed, 29 Jul 2020 01:27:28 +0000 (09:27 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 29 Jul 2020 07:07:26 +0000 (15:07 +0800)
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>
qa/tasks/ceph.py

index 71fc2eafae19ad09017c5aed374f0be24563a454..3eb63406d4dd8392fdfc8a4a1e5b97bf8a1d1604 100644 (file)
@@ -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)