]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: test_readahead add kernel client support
authorXiubo Li <xiubli@redhat.com>
Thu, 12 Nov 2020 06:18:16 +0000 (14:18 +0800)
committerVenky Shankar <vshankar@redhat.com>
Fri, 10 Dec 2021 09:08:26 +0000 (14:38 +0530)
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>
(cherry picked from commit 2f4980f394301fca793af9ca513aca6fa1d1822a)

qa/tasks/cephfs/fuse_mount.py
qa/tasks/cephfs/kernel_mount.py
qa/tasks/cephfs/mount.py
qa/tasks/cephfs/test_readahead.py

index 53ec26a77844dc414a8f8855f8d95977ca47d74b..c5ead4cb64f25be15732e1825f50a7c799263a35 100644 (file)
@@ -505,3 +505,6 @@ print(find_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 7ef3f68f8f810cbcb250c5af626cf57b6ab1fcf7..1d35545c60e4457d9ee89b2e1be70fd96923a3ef 100644 (file)
@@ -261,3 +261,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 e4d6d659e2c4d3509e1191d7bb16c6fdfe29382e..059f1a36d99a9069a4325baa431332c12e1ce1da 100644 (file)
@@ -597,6 +597,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))