]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/rbd_fio: unmap rbd devices on cleanup 13104/head
authorIlya Dryomov <idryomov@gmail.com>
Wed, 31 Aug 2016 17:30:19 +0000 (19:30 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 25 Jan 2017 15:17:13 +0000 (16:17 +0100)
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 15be2d29be3e42644b0c541f5c70461f1874f24f)

qa/tasks/rbd_fio.py

index 9ff7deb32eaa4ee4866147aa751d4ba3851c91e9..4bd2fd360dc96d2e9e0976e4d8245b2d59bd020a 100644 (file)
@@ -6,6 +6,7 @@
 
 """
 import contextlib
+import json
 import logging
 import StringIO
 import re
@@ -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':