mirror of
https://github.com/ceph/ceph
synced 2025-02-22 02:27:29 +00:00
admin_socket: loop until the socket command succeeds
Sometimes the thing we're talking to is slow to start, or to register the command we are running. Loop in that case, at least for a while. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
37a662442d
commit
222b296019
@ -68,18 +68,26 @@ def _socket_command(ctx, remote, socket_path, command, args):
|
||||
"""
|
||||
json_fp = StringIO()
|
||||
testdir = teuthology.get_testdir(ctx)
|
||||
remote.run(
|
||||
args=[
|
||||
'sudo',
|
||||
'{tdir}/adjust-ulimits'.format(tdir=testdir),
|
||||
'ceph-coverage',
|
||||
'{tdir}/archive/coverage'.format(tdir=testdir),
|
||||
'ceph',
|
||||
'--admin-daemon', socket_path,
|
||||
command,
|
||||
] + args,
|
||||
stdout=json_fp,
|
||||
)
|
||||
max_tries = 60
|
||||
while True:
|
||||
proc = remote.run(
|
||||
args=[
|
||||
'sudo',
|
||||
'{tdir}/adjust-ulimits'.format(tdir=testdir),
|
||||
'ceph-coverage',
|
||||
'{tdir}/archive/coverage'.format(tdir=testdir),
|
||||
'ceph',
|
||||
'--admin-daemon', socket_path,
|
||||
command,
|
||||
] + args,
|
||||
stdout=json_fp,
|
||||
)
|
||||
if proc.exitstatus == 0:
|
||||
break
|
||||
assert max_tries > 0
|
||||
max_tries -= 1
|
||||
log.info('ceph cli returned an error, command not registered yet? sleeping and retrying ...')
|
||||
time.sleep(1)
|
||||
out = json_fp.getvalue()
|
||||
json_fp.close()
|
||||
log.debug('admin socket command %s returned %s', command, out)
|
||||
|
Loading…
Reference in New Issue
Block a user