]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/cephfs: add test for renewing stale session
authorYan, Zheng <zyan@redhat.com>
Tue, 1 May 2018 04:26:51 +0000 (12:26 +0800)
committerPrashant D <pdhange@redhat.com>
Mon, 21 May 2018 11:16:27 +0000 (07:16 -0400)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 5688476513a78cf9ab2cf3b1f65e6244f05ea73d)

Conflicts:
qa/tasks/cephfs/test_client_recovery.py: Added test test_stale_renew

qa/suites/fs/basic_functional/tasks/client-recovery.yaml
qa/suites/kcephfs/recovery/tasks/client-recovery.yaml
qa/tasks/cephfs/fuse_mount.py
qa/tasks/cephfs/test_client_recovery.py

index f5e9a0b5cf46169a2a7a92dbe508941f25e6ad4b..a2f56299b221ab995bb74cce0c3d672e0dcee200 100644 (file)
@@ -10,5 +10,6 @@ overrides:
 
 tasks:
   - cephfs_test_runner:
+      fail_on_skip: false
       modules:
         - tasks.cephfs.test_client_recovery
index 72ce013fabfc9c4c71692c8189b5b20a02630980..725a259d24f3225504bee08611a34d48e3ce7282 100644 (file)
@@ -10,5 +10,6 @@ overrides:
 
 tasks:
   - cephfs_test_runner:
+      fail_on_skip: false
       modules:
         - tasks.cephfs.test_client_recovery
index 8d8410c69edce471954f347a10b0759964feaf99..488399aa884206e0321df4916e78d8169c3813dc 100644 (file)
@@ -407,9 +407,15 @@ print find_socket("{client_name}")
         """
         Look up the CephFS client ID for this mount
         """
-
         return self.admin_socket(['mds_sessions'])['id']
 
+    def get_client_pid(self):
+        """
+        return pid of ceph-fuse process
+        """
+        status = self.admin_socket(['status'])
+        return status['metadata']['pid']
+
     def get_osd_epoch(self):
         """
         Return 2-tuple of osd_epoch, osd_epoch_barrier
index fd58c1427338e1cf1f234ec55361e33b56782730..68f04f6a6d90fd1bb2ca1a5f05f9a92668a54fe9 100644 (file)
@@ -11,8 +11,10 @@ import re
 import os
 
 from teuthology.orchestra.run import CommandFailedError, ConnectionLostError
+from tasks.cephfs.fuse_mount import FuseMount
 from tasks.cephfs.cephfs_test_case import CephFSTestCase
 from teuthology.packaging import get_package_version
+from unittest import SkipTest
 
 
 log = logging.getLogger(__name__)
@@ -472,3 +474,37 @@ class TestClientRecovery(CephFSTestCase):
         self.mount_b.mount()
         self.mount_b.wait_until_mounted()
         self.mount_b.run_shell(["ls", "subdir/childfile"])
+
+    def test_stale_renew(self):
+        if not isinstance(self.mount_a, FuseMount):
+            raise SkipTest("Require FUSE client to handle signal STOP/CONT")
+
+        session_timeout = self.fs.get_var("session_timeout")
+
+        self.mount_a.run_shell(["mkdir", "testdir"])
+        self.mount_a.run_shell(["touch", "testdir/file1"])
+        # populate readdir cache
+        self.mount_a.run_shell(["ls", "testdir"])
+        self.mount_b.run_shell(["ls", "testdir"])
+
+        # check if readdir cache is effective
+        initial_readdirs = self.fs.mds_asok(['perf', 'dump', 'mds_server', 'req_readdir_latency'])
+        self.mount_b.run_shell(["ls", "testdir"])
+        current_readdirs = self.fs.mds_asok(['perf', 'dump', 'mds_server', 'req_readdir_latency'])
+        self.assertEqual(current_readdirs, initial_readdirs);
+
+        mount_b_gid = self.mount_b.get_global_id()
+        mount_b_pid = self.mount_b.get_client_pid()
+        # stop ceph-fuse process of mount_b
+        self.mount_b.client_remote.run(args=["sudo", "kill", "-STOP", mount_b_pid])
+
+        self.assert_session_state(mount_b_gid, "open")
+        time.sleep(session_timeout * 1.5)  # Long enough for MDS to consider session stale
+        self.assert_session_state(mount_b_gid, "stale")
+
+        self.mount_a.run_shell(["touch", "testdir/file2"])
+
+        # resume ceph-fuse process of mount_b
+        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"])