From 47cdd70b5e64ff799335c28dc7cb4cd01a2a1ff6 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 23 Sep 2014 22:44:37 -0700 Subject: [PATCH] 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 --- teuthology/task/knfsd.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/teuthology/task/knfsd.py b/teuthology/task/knfsd.py index 55bb937f6c..fea04c14c6 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', + ], + ) -- 2.39.5