From: Sage Weil Date: Wed, 7 Jul 2021 17:50:39 +0000 (-0400) Subject: qa/tasks/cephfs/test_nfs: retry mount a few times X-Git-Tag: v17.1.0~1390^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1e6fd912f646c77d22bf38f28d50d31f9679fe4c;p=ceph.git qa/tasks/cephfs/test_nfs: retry mount a few times It may take a moment for a ganesha to (re)configure itself with a new export. If a mount fails, retry a couple times. Signed-off-by: Sage Weil --- diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index dae3e9f9d6cf..cf08f88d4e37 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -254,14 +254,22 @@ class TestNFS(MgrTestCase): :param ip: IP of deployed nfs cluster :param check: It denotes if i/o testing needs to be done ''' - try: - self.ctx.cluster.run(args=['sudo', 'mount', '-t', 'nfs', '-o', f'port={port}', - f'{ip}:{pseudo_path}', '/mnt']) - except CommandFailedError as e: - # Check if mount failed only when non existing pseudo path is passed - if not check and e.exitstatus == 32: - return - raise + 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 as e: + if tries: + tries -= 1 + time.sleep(2) + continue + # Check if mount failed only when non existing pseudo path is passed + if not check and e.exitstatus == 32: + return + raise self.ctx.cluster.run(args=['sudo', 'chmod', '1777', '/mnt'])