]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: test_readahead add kernel client support 38037/head
authorXiubo Li <xiubli@redhat.com>
Thu, 12 Nov 2020 06:18:16 +0000 (14:18 +0800)
committerXiubo Li <xiubli@redhat.com>
Fri, 18 Dec 2020 01:07:26 +0000 (09:07 +0800)
If the "ceph.cluster_fsid" and "ceph.client_id" vxattrs or the
"metric" debug file are not support yet, will assume the test
succeeds.

Fixes: https://tracker.ceph.com/issues/48053
Signed-off-by: Xiubo Li <xiubli@redhat.com>
qa/tasks/cephfs/fuse_mount.py
qa/tasks/cephfs/kernel_mount.py
qa/tasks/cephfs/mount.py
qa/tasks/cephfs/test_readahead.py

index 360c4a32b110cd3c8fe8863829ce5176d9662d2e..711a3978669177288f7f3a9d786fbad2eb6a1614 100644 (file)
@@ -511,3 +511,6 @@ print(_find_admin_socket("{client_name}"))
 
     def set_cache_size(self, size):
         return self.admin_socket(['config', 'set', 'client_cache_size', str(size)])
+
+    def get_op_read_count(self):
+        return self.admin_socket(['perf', 'dump', 'objecter'])['objecter']['osdop_read']
index 03ab3ddaaa861939e97f244bbeaa8db4c34734de..9845454199ad7aea555653cf70bd7531899d370c 100644 (file)
@@ -286,3 +286,10 @@ class KernelMount(CephFSMount):
         epoch, barrier = int(first_line_tokens[1]), int(first_line_tokens[3])
 
         return epoch, barrier
+
+    def get_op_read_count(self):
+        buf = self.read_debug_file("metrics")
+        if buf is None:
+            return 0
+        else:
+            return int(re.findall(r'read.*', buf)[0].split()[1])
index 61fd1574e40e91bb990af091b16241bcac9b05c9..6d2ce064768fac50860000f597abb6a49d7d00bd 100644 (file)
@@ -1104,6 +1104,9 @@ class CephFSMount(object):
     def get_osd_epoch(self):
         raise NotImplementedError()
 
+    def get_op_read_count(self):
+        raise NotImplementedError()
+
     def lstat(self, fs_path, follow_symlinks=False, wait=True):
         return self.stat(fs_path, follow_symlinks=False, wait=True)
 
index 28c544c649433491d026bfdf5fc301f8e2cf8b7a..b1484ab0713e5a8cb3197a865e6395f9be293400 100644 (file)
@@ -1,5 +1,4 @@
 import logging
-from tasks.cephfs.fuse_mount import FuseMount
 from tasks.cephfs.cephfs_test_case import CephFSTestCase
 
 log = logging.getLogger(__name__)
@@ -7,9 +6,6 @@ log = logging.getLogger(__name__)
 
 class TestReadahead(CephFSTestCase):
     def test_flush(self):
-        if not isinstance(self.mount_a, FuseMount):
-            self.skipTest("FUSE needed for measuring op counts")
-
         # Create 32MB file
         self.mount_a.run_shell(["dd", "if=/dev/urandom", "of=foo", "bs=1M", "count=32"])
 
@@ -17,9 +13,10 @@ class TestReadahead(CephFSTestCase):
         self.mount_a.umount_wait()
         self.mount_a.mount_wait()
 
-        initial_op_read = self.mount_a.admin_socket(['perf', 'dump', 'objecter'])['objecter']['osdop_read']
+        initial_op_read = self.mount_a.get_op_read_count()
         self.mount_a.run_shell(["dd", "if=foo", "of=/dev/null", "bs=128k", "count=32"])
-        op_read = self.mount_a.admin_socket(['perf', 'dump', 'objecter'])['objecter']['osdop_read']
+        op_read = self.mount_a.get_op_read_count()
+
         assert op_read >= initial_op_read
         op_read -= initial_op_read
         log.info("read operations: {0}".format(op_read))