]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | import logging |
2 | from tasks.cephfs.fuse_mount import FuseMount | |
3 | from tasks.cephfs.cephfs_test_case import CephFSTestCase | |
4 | ||
5 | log = logging.getLogger(__name__) | |
6 | ||
7 | ||
8 | class TestReadahead(CephFSTestCase): | |
9 | def test_flush(self): | |
10 | if not isinstance(self.mount_a, FuseMount): | |
11 | self.skipTest("FUSE needed for measuring op counts") | |
12 | ||
13 | # Create 32MB file | |
14 | self.mount_a.run_shell(["dd", "if=/dev/urandom", "of=foo", "bs=1M", "count=32"]) | |
15 | ||
16 | # Unmount and remount the client to flush cache | |
17 | self.mount_a.umount_wait() | |
18 | self.mount_a.mount() | |
19 | self.mount_a.wait_until_mounted() | |
20 | ||
21 | initial_op_r = self.mount_a.admin_socket(['perf', 'dump', 'objecter'])['objecter']['op_r'] | |
22 | self.mount_a.run_shell(["dd", "if=foo", "of=/dev/null", "bs=128k", "count=32"]) | |
23 | op_r = self.mount_a.admin_socket(['perf', 'dump', 'objecter'])['objecter']['op_r'] | |
24 | assert op_r >= initial_op_r | |
25 | op_r -= initial_op_r | |
26 | log.info("read operations: {0}".format(op_r)) | |
27 | ||
28 | # with exponentially increasing readahead, we should see fewer than 10 operations | |
29 | # but this test simply checks if the client is doing a remote read for each local read | |
30 | if op_r >= 32: | |
31 | raise RuntimeError("readahead not working") |