From 61e1b0caddfbc3721cd9fa2de5b90b2f65740f79 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Wed, 31 Aug 2016 19:30:19 +0200 Subject: [PATCH] tasks/rbd_fio: unmap rbd devices on cleanup 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 (cherry picked from commit 15be2d29be3e42644b0c541f5c70461f1874f24f) --- qa/tasks/rbd_fio.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qa/tasks/rbd_fio.py b/qa/tasks/rbd_fio.py index 9ff7deb32eaa4..4bd2fd360dc96 100644 --- a/qa/tasks/rbd_fio.py +++ b/qa/tasks/rbd_fio.py @@ -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': -- 2.39.5