]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
enable lsof when unmounting nfs clients 336/head
authorGreg Farnum <greg@inktank.com>
Wed, 24 Sep 2014 05:44:37 +0000 (22:44 -0700)
committerGreg Farnum <greg@inktank.com>
Wed, 24 Sep 2014 21:13:05 +0000 (14:13 -0700)
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 <greg@inktank.com>
teuthology/task/knfsd.py

index 55bb937f6c5cf1d8638a06684ab90a2633593072..fea04c14c68b116223da47be2afc10e46945a18f 100644 (file)
@@ -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',
+                        ],
+                    )