From: Xiubo Li Date: Thu, 14 May 2020 09:11:33 +0000 (-0400) Subject: qa/tasks/cephfs/fuse_mount.py: retry when the admin socket is not ready X-Git-Tag: v16.1.0~2302^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F35062%2Fhead;p=ceph.git 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 --- 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): """