]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/cephfs: add test for ceph_abort_conn() 22543/head
authorYan, Zheng <zyan@redhat.com>
Thu, 28 Jun 2018 07:45:39 +0000 (15:45 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 28 Jun 2018 08:16:50 +0000 (16:16 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
qa/tasks/cephfs/test_client_recovery.py

index c70e224714eda00ca568e3f5a37975640f7a51db..9b363267652b0a9e9c9f23b8dc13c6be7d191bb8 100644 (file)
@@ -519,3 +519,30 @@ class TestClientRecovery(CephFSTestCase):
         self.mount_b.client_remote.run(args=["sudo", "kill", "-CONT", mount_b_pid])
         # Is the new file visible from mount_b? (caps become invalid after session stale)
         self.mount_b.run_shell(["ls", "testdir/file2"])
+
+    def test_abort_conn(self):
+        """
+        Check that abort_conn() skips closing mds sessions.
+        """
+        if not isinstance(self.mount_a, FuseMount):
+            raise SkipTest("Testing libcephfs function")
+
+        session_timeout = self.fs.get_var("session_timeout")
+
+        self.mount_a.umount_wait()
+        self.mount_b.umount_wait()
+
+        gid_str = self.mount_a.run_python(dedent("""
+            import cephfs as libcephfs
+            cephfs = libcephfs.LibCephFS(conffile='')
+            cephfs.mount()
+            client_id = cephfs.get_instance_id()
+            cephfs.abort_conn()
+            print client_id
+            """)
+        )
+        gid = int(gid_str);
+
+        self.assert_session_state(gid, "open")
+        time.sleep(session_timeout * 1.5)  # Long enough for MDS to consider session stale
+        self.assert_session_state(gid, "stale")