]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/cephfs: add a method to check if CephFS mounts have hanged
authorRishabh Dave <ridave@redhat.com>
Wed, 10 Aug 2022 16:53:10 +0000 (22:23 +0530)
committerRishabh Dave <ridave@redhat.com>
Fri, 19 Aug 2022 14:10:38 +0000 (19:40 +0530)
Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/cephfs/mount.py

index 065c0ff937893cfe970caa0130ece0768d55afb4..89dbe5111208c73200c1da96aa053911ef1674d5 100644 (file)
@@ -168,6 +168,26 @@ class CephFSMount(object):
                      get_file(self.client_remote, self.client_keyring_path,
                               sudo=True).decode())
 
+    def is_stuck(self):
+        """
+        Check if mount is stuck/in a hanged state.
+        """
+        if not self.is_mounted():
+            return False
+
+        retval = self.client_remote.run(args=f'sudo stat {self.hostfs_mntpt}',
+                                        omit_sudo=False, wait=False).returncode
+        if retval == 0:
+            return False
+
+        time.sleep(10)
+        proc = self.client_remote.run(args='ps -ef', stdout=StringIO())
+        # if proc was running even after 10 seconds, it has to be stuck.
+        if f'stat {self.hostfs_mntpt}' in proc.stdout.getvalue():
+            log.critical('client mounted at self.hostfs_mntpt is stuck!')
+            return True
+        return False
+
     def is_mounted(self):
         return self.hostfs_mntpt in \
             self.client_remote.read_file('/proc/self/mounts',stdout=StringIO())