From 211c3fbb4b031233379a31e89d776a482a8aa36b Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Thu, 23 Apr 2020 22:24:01 -0400 Subject: [PATCH] qa/tasks/cephfs/fuse_mount: fix possible chmod 1777 error INFO:teuthology.orchestra.run.smithi13a2:> (cd /home/ubuntu/cephtest && exec sudo chmod 1777 /home/ubuntu/cephtest/mnt.2) INFO:teuthology.orchestra.run.smithi132.stderr:chmod: changing permissions of '/home/ubuntu/cephtest/mnt.2': Permission denied DEBUG:teuthology.orchestra.run:got remote process result: 1 Here just wait and rety for 10 times. Signed-off-by: Xiubo Li --- qa/tasks/cephfs/fuse_mount.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/qa/tasks/cephfs/fuse_mount.py b/qa/tasks/cephfs/fuse_mount.py index 179a2dfdea5..f46689b5b06 100644 --- a/qa/tasks/cephfs/fuse_mount.py +++ b/qa/tasks/cephfs/fuse_mount.py @@ -240,15 +240,20 @@ class FuseMount(CephFSMount): # Now that we're mounted, set permissions so that the rest of the test will have # unrestricted access to the filesystem mount. - try: - stderr = StringIO() - self.client_remote.run(args=['sudo', 'chmod', '1777', self.mountpoint], timeout=(15*60), cwd=self.test_dir, stderr=stderr) - except run.CommandFailedError: - stderr = stderr.getvalue() - if "Read-only file system".lower() in stderr.lower(): - pass - else: - raise + for retry in range(10): + try: + stderr = StringIO() + self.client_remote.run(args=['sudo', 'chmod', '1777', self.mountpoint], + timeout=(15*60), cwd=self.test_dir, stderr=stderr) + break + except run.CommandFailedError: + stderr = stderr.getvalue() + if "Read-only file system".lower() in stderr.lower(): + break + elif "Permission denied".lower() in stderr.lower(): + time.sleep(5) + else: + raise def _mountpoint_exists(self): return self.client_remote.run(args=["ls", "-d", self.mountpoint], check_status=False, cwd=self.test_dir, timeout=(15*60)).exitstatus == 0