]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
dump_stuck: verify that 'ceph health' mentions the right number of inactive/unclean...
authorJosh Durgin <josh.durgin@dreamhost.com>
Tue, 28 Feb 2012 21:55:46 +0000 (13:55 -0800)
committerJosh Durgin <josh.durgin@dreamhost.com>
Tue, 28 Feb 2012 21:55:46 +0000 (13:55 -0800)
teuthology/task/dump_stuck.py

index 8f7d1cc969b74e6630c7868f04e9d2ecae82f85a..c482be017d76957a1755f8e52effeb3a076576d9 100644 (file)
@@ -1,4 +1,5 @@
 import logging
+import re
 import time
 
 import ceph_manager
@@ -15,6 +16,19 @@ def check_stuck(manager, num_inactive, num_unclean, num_stale, timeout=10):
     stale = manager.get_stuck_pgs('stale', timeout)
     assert len(stale) == num_stale
 
+    # check health output as well
+    health = manager.raw_cluster_cmd('health')
+    log.debug('ceph health is: %s', health)
+    if num_inactive > 0:
+        m = re.search('(\d+) pgs stuck inactive', health)
+        assert int(m.group(1)) == num_inactive
+    if num_unclean > 0:
+        m = re.search('(\d+) pgs stuck unclean', health)
+        assert int(m.group(1)) == num_unclean
+    if num_stale > 0:
+        m = re.search('(\d+) pgs stuck stale', health)
+        assert int(m.group(1)) == num_stale
+
 def task(ctx, config):
     """
     Test the dump_stuck command.
@@ -34,7 +48,10 @@ def task(ctx, config):
         logger=log.getChild('ceph_manager'),
         )
 
+    manager.raw_cluster_cmd('tell', 'osd.0', 'flush_pg_stats')
+    manager.raw_cluster_cmd('tell', 'osd.1', 'flush_pg_stats')
     manager.wait_for_clean(timeout)
+
     check_stuck(
         manager,
         num_inactive=0,