From: Greg Farnum Date: Wed, 24 Sep 2014 05:44:37 +0000 (-0700) Subject: enable lsof when unmounting nfs clients X-Git-Tag: 1.1.0~1154^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F336%2Fhead;p=teuthology.git enable lsof when unmounting nfs clients Because the lsof interface is strange, use the verbose flag so we get some output even if there is no use, and ignore errors because it will return 1 if there's no filesystem use. Signed-off-by: Greg Farnum --- diff --git a/teuthology/task/knfsd.py b/teuthology/task/knfsd.py index 55bb937f6..fea04c14c 100644 --- a/teuthology/task/knfsd.py +++ b/teuthology/task/knfsd.py @@ -133,10 +133,21 @@ def task(ctx, config): for id_, remote in clients: log.debug('Unexporting client client.{id}...'.format(id=id_)) mnt = os.path.join(teuthology.get_testdir(ctx), 'mnt.{id}'.format(id=id_)) - remote.run( - args=[ - 'sudo', - 'exportfs', - '-au', - ], - ) + log.debug('Checking active files on mount {mnt}'.format(mnt=mnt)) + try: + remote.run( + args=[ + 'sudo', + 'lsof', '-V', + '{mnt}'.format(mnt=mnt), + ], + check_status=False + ) + finally: + remote.run( + args=[ + 'sudo', + 'exportfs', + '-au', + ], + )