]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
nuke: improve stale_kernel_mount() check
authorIlya Dryomov <idryomov@gmail.com>
Fri, 3 Feb 2017 09:59:43 +0000 (10:59 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 3 Feb 2017 13:47:44 +0000 (14:47 +0100)
Commit 7db9e8b76fd5 ("nuke: bring stale kernel client handling back")
resurrected the check that was removed in commit 1d47a121b385 ("Fix
nuke, redo some cleanup functions").  It isn't sufficient though -- for
example, if a workunit already issued a umount, /etc/mtab won't have
a '^/dev/rbd' entry.

debugfs is enabled and mounted on all distros we care about.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
teuthology/nuke/actions.py

index de3ed28d1aacbf17e3ac76feb4401d38f4a6ed60..c3eee973bb119205e6f57887b02fc113a9d64ed6 100644 (file)
@@ -135,14 +135,16 @@ def remove_osd_tmpfs(ctx):
 def stale_kernel_mount(remote):
     proc = remote.run(
         args=[
-            'grep', '-q', ' ceph ', '/etc/mtab',
-            run.Raw('||'),
-            'grep', '-q', '^/dev/rbd', '/etc/mtab',
+            'sudo', 'find',
+            '/sys/kernel/debug/ceph',
+            '-mindepth', '1',
+            '-type', 'd',
+            run.Raw('|'),
+            'read'
         ],
         check_status=False
     )
-    # grep exists with 1 if no lines were selected
-    return proc.exitstatus != 1
+    return proc.exitstatus == 0
 
 
 def reboot(ctx, remotes):