Skip to content

Commit

Permalink
rados: check that pool is done trimming before removing it
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Just <sjust@redhat.com>
  • Loading branch information
athanatos committed Feb 13, 2017
1 parent c2eac34 commit 4aebf59
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions qa/tasks/ceph_manager.py
Expand Up @@ -1650,6 +1650,33 @@ def do_pg_scrub(self, pool, pgnum, stype):
time.sleep(SLEEP_TIME)
timer += SLEEP_TIME

def wait_snap_trimming_complete(self, pool):
"""
Wait for snap trimming on pool to end
"""
POLL_PERIOD = 10
FATAL_TIMEOUT = 600
start = time.time()
poolnum = self.get_pool_num(pool)
poolnumstr = "%s." % (poolnum,)
while (True):
now = time.time()
if (now - start) > FATAL_TIMEOUT:
assert (now - start) < FATAL_TIMEOUT, \
'failed to complete snap trimming before timeout'
all_stats = self.get_pg_stats()
trimming = False
for pg in all_stats:
if (poolnumstr in pg['pgid']) and ('snaptrim' in pg['state']):
self.log("pg {pg} in trimming, state: {state}".format(
pg=pg['pgid'],
state=pg['state']))
trimming = True
if not trimming:
break
self.log("{pool} still trimming, waiting".format(pool=pool))
time.sleep(POLL_PERIOD)

def get_single_pg_stats(self, pgid):
"""
Return pg for the pgid specified.
Expand Down
1 change: 1 addition & 0 deletions qa/tasks/rados.py
Expand Up @@ -250,6 +250,7 @@ def thread():
run.wait(tests.itervalues())

for pool in created_pools:
manager.wait_snap_trimming_complete(pool);
manager.remove_pool(pool)

running = gevent.spawn(thread)
Expand Down

0 comments on commit 4aebf59

Please sign in to comment.