Skip to content

Commit

Permalink
tasks/rbd_fio: unmap rbd devices on cleanup
Browse files Browse the repository at this point in the history
Not doing so leads to issues and can interfere with subsequent jobs.
One example is the invocation of vgs(8) during the inital test setup:
it will issue a read to the left-behind rbd device(s) whose backing
cluster is long gone, locking up the job.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 15be2d2)
  • Loading branch information
idryomov committed Jan 25, 2017
1 parent 5fcfa32 commit 61e1b0c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions qa/tasks/rbd_fio.py
Expand Up @@ -6,6 +6,7 @@
"""
import contextlib
import json
import logging
import StringIO
import re
Expand Down Expand Up @@ -196,6 +197,13 @@ def run_fio(remote, config, rbd_test_dir):
remote.run(args=['sudo', run.Raw('{tdir}/fio-fio-{v}/fio {f}'.format(tdir=rbd_test_dir,v=fio_version,f=fio_config.name))])
remote.run(args=['ceph', '-s'])
finally:
out=StringIO.StringIO()
remote.run(args=['rbd','showmapped', '--format=json'], stdout=out)
mapped_images = json.loads(out.getvalue())
if mapped_images:
log.info("Unmapping rbd images on {sn}".format(sn=sn))
for image in mapped_images.itervalues():
remote.run(args=['sudo', 'rbd', 'unmap', str(image['device'])])
log.info("Cleaning up fio install")
remote.run(args=['rm','-rf', run.Raw(rbd_test_dir)])
if system_type == 'rpm' and ioengine == 'rbd':
Expand Down

0 comments on commit 61e1b0c

Please sign in to comment.