From 422d736568bd4d92fdf380b07da0ccac46cf3efd Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Thu, 14 May 2020 05:11:33 -0400 Subject: [PATCH] qa/tasks/cephfs/fuse_mount.py: retry when the admin socket is not ready Fixes: https://tracker.ceph.com/issues/45552 Signed-off-by: Xiubo Li --- qa/tasks/cephfs/fuse_mount.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/qa/tasks/cephfs/fuse_mount.py b/qa/tasks/cephfs/fuse_mount.py index f46689b5b06f4..2fcd401d6afd6 100644 --- a/qa/tasks/cephfs/fuse_mount.py +++ b/qa/tasks/cephfs/fuse_mount.py @@ -9,6 +9,7 @@ from textwrap import dedent from teuthology import misc from teuthology.contextutil import MaxWhileTries +from teuthology.contextutil import safe_while from teuthology.orchestra import run from teuthology.orchestra.run import CommandFailedError from tasks.cephfs.mount import CephFSMount @@ -439,12 +440,21 @@ print(find_socket("{client_name}")) timeout=(15*60)).strip() log.info("Found client admin socket at {0}".format(asok_path)) - # Query client ID from admin socket - json_data = self.client_remote.sh( - ['sudo', self._prefix + 'ceph', '--admin-daemon', asok_path] + args, - stdout=StringIO(), - timeout=(15*60)) - return json.loads(json_data) + # Query client ID from admin socket, wait 2 seconds + # and retry 10 times if it is not ready + with safe_while(sleep=2, tries=10) as proceed: + while proceed(): + try: + p = self.client_remote.run(args= + ['sudo', self._prefix + 'ceph', '--admin-daemon', asok_path] + args, + stdout=StringIO(), stderr=StringIO(), + timeout=(15*60)) + break + except CommandFailedError: + if "Connection refused" in stderr.getvalue(): + pass + + return json.loads(p.stdout.getvalue().strip()) def get_global_id(self): """ -- 2.47.3