]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephfs: test readahead is working
authorPatrick Donnelly <batrick@batbytes.com>
Wed, 8 Jun 2016 19:29:17 +0000 (15:29 -0400)
committerPatrick Donnelly <batrick@batbytes.com>
Thu, 9 Jun 2016 15:07:45 +0000 (11:07 -0400)
Test case for: https://github.com/ceph/ceph/pull/9374
Issue: http://tracker.ceph.com/issues/16024

Signed-off-by: Patrick Donnelly <batrick@batbytes.com>
suites/fs/recovery/tasks/client-readahad.yaml [new file with mode: 0644]
tasks/cephfs/test_readahead.py [new file with mode: 0644]

diff --git a/suites/fs/recovery/tasks/client-readahad.yaml b/suites/fs/recovery/tasks/client-readahad.yaml
new file mode 100644 (file)
index 0000000..1d178e5
--- /dev/null
@@ -0,0 +1,4 @@
+tasks:
+  - cephfs_test_runner:
+      modules:
+        - tasks.cephfs.test_readahead
diff --git a/tasks/cephfs/test_readahead.py b/tasks/cephfs/test_readahead.py
new file mode 100644 (file)
index 0000000..39f4fb8
--- /dev/null
@@ -0,0 +1,26 @@
+import logging
+from tasks.cephfs.cephfs_test_case import CephFSTestCase
+
+log = logging.getLogger(__name__)
+
+class TestReadahead(CephFSTestCase):
+    def test_flush(self):
+        # Create 32MB file
+        self.mount_a.run_shell(["dd", "if=/dev/urandom", "of=foo", "bs=1M", "count=32"])
+
+        # Unmount and remount the client to flush cache
+        self.mount_a.umount_wait()
+        self.mount_a.mount()
+        self.mount_a.wait_until_mounted()
+
+        initial_op_r = self.mount_a.admin_socket(['perf', 'dump', 'objecter'])['objecter']['op_r']
+        self.mount_a.run_shell(["dd", "if=foo", "of=/dev/null", "bs=128k", "count=32"])
+        op_r = self.mount_a.admin_socket(['perf', 'dump', 'objecter'])['objecter']['op_r']
+        assert op_r >= initial_op_r
+        op_r -= initial_op_r
+        log.info("read operations: {0}".format(op_r))
+
+        # with exponentially increasing readahead, we should see fewer than 10 operations
+        # but this test simply checks if the client is doing a remote read for each local read
+        if op_r >= 32:
+            raise RuntimeError("readahead not working")