]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: use curl in wait_for_radosgw() in util/rgw.py 28521/head
authorAli Maredia <amaredia@redhat.com>
Wed, 12 Jun 2019 20:12:47 +0000 (16:12 -0400)
committerAli Maredia <amaredia@redhat.com>
Thu, 13 Jun 2019 16:05:56 +0000 (12:05 -0400)
Signed-off-by: Ali Maredia <amaredia@redhat.com>
qa/tasks/rgw.py
qa/tasks/rgw_multisite.py
qa/tasks/util/rgw.py

index fc3bd03dabe343ebd3666304eace723c2f203eea..42de0efe66358cd0430b54930c3b16044ba9def9 100644 (file)
@@ -147,7 +147,8 @@ def start_rgw(ctx, config, clients):
         endpoint = ctx.rgw.role_endpoints[client]
         url = endpoint.url()
         log.info('Polling {client} until it starts accepting connections on {url}'.format(client=client, url=url))
-        wait_for_radosgw(url)
+        (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+        wait_for_radosgw(url, remote)
 
     try:
         yield
index 67b9a6f0c021983bf202fe903caef1710b0ab68f..9dea39312dee37d229aa059781db42d119c9a829 100644 (file)
@@ -231,7 +231,7 @@ class Gateway(multisite.Gateway):
         """ (re)start the daemon """
         self.daemon.restart()
         # wait until startup completes
-        wait_for_radosgw(self.endpoint())
+        wait_for_radosgw(self.endpoint(), self.remote)
 
     def stop(self):
         """ stop the daemon """
index ab76b50a2282f84a181e19373ee6d959add8dc51..ee79208cc5bd726514c8350faa44e957d2eb8385 100644 (file)
@@ -2,6 +2,7 @@ from cStringIO import StringIO
 import logging
 import json
 import requests
+import time
 
 from requests.packages.urllib3 import PoolManager
 from requests.packages.urllib3.util import Retry
@@ -70,12 +71,29 @@ def get_user_successful_ops(out, user):
         return 0
     return get_user_summary(out, user)['total']['successful_ops']
 
-def wait_for_radosgw(url):
+def wait_for_radosgw(url, remote):
     """ poll the given url until it starts accepting connections
 
     add_daemon() doesn't wait until radosgw finishes startup, so this is used
     to avoid racing with later tasks that expect radosgw to be up and listening
     """
-    # use a connection pool with retry/backoff to poll until it starts listening
-    http = PoolManager(retries=Retry(connect=8, backoff_factor=1))
-    http.request('GET', url)
+    # TODO: use '--retry-connrefused --retry 8' when teuthology is running on
+    # Centos 8 and other OS's with an updated version of curl
+    curl_cmd = ['curl',
+                url]
+    exit_status = 0
+    num_retries = 8
+    for seconds in range(num_retries):
+        proc = remote.run(
+            args=curl_cmd,
+            check_status=False,
+            stdout=StringIO(),
+            stderr=StringIO(),
+            stdin=StringIO(),
+            )
+        exit_status = proc.exitstatus
+        if exit_status == 0:
+            break
+        time.sleep(2**seconds)
+
+    assert exit_status == 0