mirror of
https://github.com/ceph/ceph
synced 2024-12-30 07:23:11 +00:00
qa/cephfs: fallback to older way of get_op_read_count
Fixes: https://tracker.ceph.com/issues/55538 Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
This commit is contained in:
parent
48e9ada562
commit
0aca27d2fc
@ -1,3 +1,4 @@
|
||||
import errno
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@ -349,8 +350,23 @@ echo '{fdata}' | sudo tee /sys/kernel/debug/dynamic_debug/control
|
||||
return epoch, barrier
|
||||
|
||||
def get_op_read_count(self):
|
||||
buf = self.read_debug_file("metrics/size")
|
||||
if buf is None:
|
||||
return 0
|
||||
else:
|
||||
return int(re.findall(r'read.*', buf)[0].split()[1])
|
||||
stdout = StringIO()
|
||||
stderr = StringIO()
|
||||
try:
|
||||
path = os.path.join(self._get_debug_dir(), "metrics/size")
|
||||
self.run_shell(f"sudo stat {path}", stdout=stdout,
|
||||
stderr=stderr, cwd=None)
|
||||
buf = self.read_debug_file("metrics/size")
|
||||
except CommandFailedError:
|
||||
if 'no such file or directory' in stderr.getvalue().lower() \
|
||||
or 'not a directory' in stderr.getvalue().lower():
|
||||
try:
|
||||
path = os.path.join(self._get_debug_dir(), "metrics")
|
||||
self.run_shell(f"sudo stat {path}", stdout=stdout,
|
||||
stderr=stderr, cwd=None)
|
||||
buf = self.read_debug_file("metrics")
|
||||
except CommandFailedError:
|
||||
return errno.ENOENT
|
||||
else:
|
||||
return 0
|
||||
return int(re.findall(r'read.*', buf)[0].split()[1])
|
||||
|
@ -16,8 +16,7 @@ class TestReadahead(CephFSTestCase):
|
||||
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.get_op_read_count()
|
||||
|
||||
assert op_read >= initial_op_read
|
||||
self.assertGreaterEqual(op_read, initial_op_read)
|
||||
op_read -= initial_op_read
|
||||
log.info("read operations: {0}".format(op_read))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user