parameters: (ctx, config)
docstring: Test the dump_stuck command.
  
      :param ctx: Context
      :param config: Configuration
docstring_summary: Test the dump_stuck command.
docstring_tokens: Test the dump_stuck command .
function: def task(ctx, config):
      """
      Test the dump_stuck command.
  
      :param ctx: Context
      :param config: Configuration
      """
      assert config is None, \
          'dump_stuck requires no configuration'
      assert teuthology.num_instances_of_type(ctx.cluster, 'osd') == 2, \
          'dump_stuck requires exactly 2 osds'
  
      timeout = 60
      first_mon = teuthology.get_first_mon(ctx, config)
      (mon,) = ctx.cluster.only(first_mon).remotes.keys()
  
      manager = ceph_manager.CephManager(
          mon,
          ctx=ctx,
          logger=log.getChild('ceph_manager'),
          )
  
      manager.flush_pg_stats([0, 1])
      manager.wait_for_clean(timeout)
  
      manager.raw_cluster_cmd('tell', 'mon.a', 'injectargs', '--',
  #                            '--mon-osd-report-timeout 90',
                              '--mon-pg-stuck-threshold 10')
  
      # all active+clean
      check_stuck(
          manager,
          num_inactive=0,
          num_unclean=0,
          num_stale=0,
          )
      num_pgs = manager.get_num_pgs()
  
      manager.mark_out_osd(0)
      time.sleep(timeout)
      manager.flush_pg_stats([1])
      manager.wait_for_recovery(timeout)
  
      # all active+clean+remapped
      check_stuck(
          manager,
          num_inactive=0,
          num_unclean=0,
          num_stale=0,
          )
  
      manager.mark_in_osd(0)
      manager.flush_pg_stats([0, 1])
      manager.wait_for_clean(timeout)
  
      # all active+clean
      check_stuck(
          manager,
          num_inactive=0,
          num_unclean=0,
          num_stale=0,
          )
  
      log.info('stopping first osd')
      manager.kill_osd(0)
      manager.mark_down_osd(0)
      manager.wait_for_active(timeout)
  
      log.info('waiting for all to be unclean')
      starttime = time.time()
      done = False
      while not done:
          try:
              check_stuck(
                  manager,
                  num_inactive=0,
                  num_unclean=num_pgs,
                  num_stale=0,
                  )
              done = True
          except AssertionError:
              # wait up to 15 minutes to become stale
              if time.time() - starttime > 900:
                  raise
  
  
      log.info('stopping second osd')
      manager.kill_osd(1)
      manager.mark_down_osd(1)
  
      log.info('waiting for all to be stale')
      starttime = time.time()
      done = False
      while not done:
          try:
              check_stuck(
                  manager,
                  num_inactive=0,
                  num_unclean=num_pgs,
                  num_stale=num_pgs,
                  )
              done = True
          except AssertionError:
              # wait up to 15 minutes to become stale
              if time.time() - starttime > 900:
                  raise
  
      log.info('reviving')
      for id_ in teuthology.all_roles_of_type(ctx.cluster, 'osd'):
          manager.revive_osd(id_)
          manager.mark_in_osd(id_)
      while True:
          try:
              manager.flush_pg_stats([0, 1])
              break
          except Exception:
              log.exception('osds must not be started yet, waiting...')
              time.sleep(1)
      manager.wait_for_clean(timeout)
  
      check_stuck(
          manager,
          num_inactive=0,
          num_unclean=0,
          num_stale=0,
          )
function_tokens: def task ( ctx , config ) : assert config is None , 'dump_stuck requires no configuration' assert teuthology . num_instances_of_type ( ctx . cluster , 'osd' ) == 2 , 'dump_stuck requires exactly 2 osds' timeout = 60 first_mon = teuthology . get_first_mon ( ctx , config ) ( mon , ) = ctx . cluster . only ( first_mon ) . remotes . keys ( ) manager = ceph_manager . CephManager ( mon , ctx = ctx , logger = log . getChild ( 'ceph_manager' ) , ) manager . flush_pg_stats ( [ 0 , 1 ] ) manager . wait_for_clean ( timeout ) manager . raw_cluster_cmd ( 'tell' , 'mon.a' , 'injectargs' , '--' , #                            '--mon-osd-report-timeout 90', '--mon-pg-stuck-threshold 10' ) # all active+clean check_stuck ( manager , num_inactive = 0 , num_unclean = 0 , num_stale = 0 , ) num_pgs = manager . get_num_pgs ( ) manager . mark_out_osd ( 0 ) time . sleep ( timeout ) manager . flush_pg_stats ( [ 1 ] ) manager . wait_for_recovery ( timeout ) # all active+clean+remapped check_stuck ( manager , num_inactive = 0 , num_unclean = 0 , num_stale = 0 , ) manager . mark_in_osd ( 0 ) manager . flush_pg_stats ( [ 0 , 1 ] ) manager . wait_for_clean ( timeout ) # all active+clean check_stuck ( manager , num_inactive = 0 , num_unclean = 0 , num_stale = 0 , ) log . info ( 'stopping first osd' ) manager . kill_osd ( 0 ) manager . mark_down_osd ( 0 ) manager . wait_for_active ( timeout ) log . info ( 'waiting for all to be unclean' ) starttime = time . time ( ) done = False while not done : try : check_stuck ( manager , num_inactive = 0 , num_unclean = num_pgs , num_stale = 0 , ) done = True except AssertionError : # wait up to 15 minutes to become stale if time . time ( ) - starttime > 900 : raise log . info ( 'stopping second osd' ) manager . kill_osd ( 1 ) manager . mark_down_osd ( 1 ) log . info ( 'waiting for all to be stale' ) starttime = time . time ( ) done = False while not done : try : check_stuck ( manager , num_inactive = 0 , num_unclean = num_pgs , num_stale = num_pgs , ) done = True except AssertionError : # wait up to 15 minutes to become stale if time . time ( ) - starttime > 900 : raise log . info ( 'reviving' ) for id_ in teuthology . all_roles_of_type ( ctx . cluster , 'osd' ) : manager . revive_osd ( id_ ) manager . mark_in_osd ( id_ ) while True : try : manager . flush_pg_stats ( [ 0 , 1 ] ) break except Exception : log . exception ( 'osds must not be started yet, waiting...' ) time . sleep ( 1 ) manager . wait_for_clean ( timeout ) check_stuck ( manager , num_inactive = 0 , num_unclean = 0 , num_stale = 0 , )