qa: Add async io test to nfs ganesha using fio

Fixes: https://tracker.ceph.com/issues/69311
Signed-off-by: Kotresh HR <khiremat@redhat.com>
This commit is contained in:
Kotresh HR 2024-10-25 15:40:42 +05:30
parent ed261a083c
commit ef942e13fa
2 changed files with 58 additions and 0 deletions

View File

@ -1,3 +1,10 @@
overrides:
install:
extra_system_packages:
rpm:
- fio
deb:
- fio
tasks:
- cephfs_test_runner:
modules:

View File

@ -369,6 +369,45 @@ class TestNFS(MgrTestCase):
except CommandFailedError as e:
self.fail(f"expected read/write of a file to be successful but failed with {e.exitstatus}")
def _mnt_nfs(self, pseudo_path, port, ip):
'''
Mount created export
:param pseudo_path: It is the pseudo root name
:param port: Port of deployed nfs cluster
:param ip: IP of deployed nfs cluster
'''
tries = 3
while True:
try:
self.ctx.cluster.run(
args=['sudo', 'mount', '-t', 'nfs', '-o', f'port={port}',
f'{ip}:{pseudo_path}', '/mnt'])
break
except CommandFailedError:
if tries:
tries -= 1
time.sleep(2)
continue
raise
self.ctx.cluster.run(args=['sudo', 'chmod', '1777', '/mnt'])
def _test_fio(self, pseudo_path, port, ip):
'''
run fio with libaio on /mnt/fio
:param mnt_path: nfs mount point
'''
try:
self._mnt_nfs(pseudo_path, port, ip)
self.ctx.cluster.run(args=['mkdir', '/mnt/fio'])
fio_cmd=['sudo', 'fio', '--ioengine=libaio', '-directory=/mnt/fio', '--filename=fio.randrw.test', '--name=job', '--bs=16k', '--direct=1', '--group_reporting', '--iodepth=128', '--randrepeat=0', '--norandommap=1', '--thread=2', '--ramp_time=20s', '--offset_increment=5%', '--size=5G', '--time_based', '--runtime=300', '--ramp_time=1s', '--percentage_random=0', '--rw=randrw', '--rwmixread=50']
self.ctx.cluster.run(args=fio_cmd)
except CommandFailedError as e:
self.fail(f"expected fio to be successful but failed with {e.exitstatus}")
finally:
self.ctx.cluster.run(args=['sudo', 'rm', '-rf', '/mnt/fio'])
self.ctx.cluster.run(args=['sudo', 'umount', '/mnt'])
def _write_to_read_only_export(self, pseudo_path, port, ip):
'''
Check if write to read only export fails
@ -627,6 +666,18 @@ class TestNFS(MgrTestCase):
self._test_data_read_write(self.pseudo_path, port, ip)
self._test_delete_cluster()
def test_async_io_fio(self):
'''
Test async io using fio. Expect completion without hang or crash
'''
self._test_create_cluster()
self._create_export(export_id='1', create_fs=True,
extra_cmd=['--pseudo-path', self.pseudo_path])
port, ip = self._get_port_ip_info()
self._check_nfs_cluster_status('running', 'NFS Ganesha cluster restart failed')
self._test_fio(self.pseudo_path, port, ip)
self._test_delete_cluster()
def test_cluster_info(self):
'''
Test cluster info outputs correct ip and hostname