From: Yan, Zheng Date: Thu, 28 Jun 2018 07:45:39 +0000 (+0800) Subject: qa/tasks/cephfs: add test for ceph_abort_conn() X-Git-Tag: v14.0.1~901^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=eb51786beb6d0c0a17ba55df534616046405c994;p=ceph-ci.git qa/tasks/cephfs: add test for ceph_abort_conn() Signed-off-by: "Yan, Zheng" --- diff --git a/qa/tasks/cephfs/test_client_recovery.py b/qa/tasks/cephfs/test_client_recovery.py index c70e224714e..9b363267652 100644 --- a/qa/tasks/cephfs/test_client_recovery.py +++ b/qa/tasks/cephfs/test_client_recovery.py @@ -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")