Skip to content

Commit

Permalink
rgw: start_rgw() polls gateway until it accepts connections
Browse files Browse the repository at this point in the history
resolves various races between radosgw startup and further operations -
both within the rgw task itself (such as the 'radosgw-admin realm pull'),
and in later tasks

Fixes: http://tracker.ceph.com/issues/17794
Fixes: http://tracker.ceph.com/issues/17872

Signed-off-by: Casey Bodley <[email protected]>
  • Loading branch information
cbodley committed Nov 16, 2016
1 parent 69bbafa commit 5e6538e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tasks/rgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import errno
import util.rgw as rgw_utils

from requests.packages.urllib3 import PoolManager
from requests.packages.urllib3.util import Retry

from cStringIO import StringIO

from teuthology.orchestra import run
Expand Down Expand Up @@ -353,6 +356,17 @@ def start_rgw(ctx, config, on_client = None, except_client = None):
wait=False,
)

# XXX: add_daemon() doesn't let us wait until radosgw finishes startup
# use a connection pool with retry/backoff to poll each gateway until it starts listening
http = PoolManager(retries=Retry(connect=8, backoff_factor=1))
for client in clients_to_run:
if client == except_client:
continue
host, port = ctx.rgw.role_endpoints[client]
endpoint = 'http://{host}:{port}/'.format(host=host, port=port)
log.info('Polling {client} until it starts accepting connections on {endpoint}'.format(client=client, endpoint=endpoint))
http.request('GET', endpoint)

try:
yield
finally:
Expand Down

0 comments on commit 5e6538e

Please sign in to comment.