]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/cephfs/fuse_mount.py: retry when the admin socket is not ready 35062/head
authorXiubo Li <xiubli@redhat.com>
Thu, 14 May 2020 09:11:33 +0000 (05:11 -0400)
committerXiubo Li <xiubli@redhat.com>
Fri, 15 May 2020 02:00:35 +0000 (22:00 -0400)
Fixes: https://tracker.ceph.com/issues/45552
Signed-off-by: Xiubo Li <xiubli@redhat.com>
qa/tasks/cephfs/fuse_mount.py

index f46689b5b06f4fda8a46d74e4a1a5a857aade70f..2fcd401d6afd608ad1507eaaaf39562f72ffa22f 100644 (file)
@@ -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):
         """