From 0166985f96ecfd3ec8ee529c1882cd9abfa1c895 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 2 May 2020 23:54:44 +0800 Subject: [PATCH] qa/tasks/ceph.py: do not use option mimic does not understand mimic does not have `mon-client-directed-command-retry` option, so we should not pass this option to a mimic ceph client. in this change, we fall back to plain retry, if command fails. this change is not cherry-picked from master. as we don't run upgrade test from mimic to master. Signed-off-by: Kefu Chai --- qa/tasks/ceph.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index aa4c9620fdc52..219c22c6c7458 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -1680,6 +1680,25 @@ def validate_config(ctx, config): last_role = role +def stop_logging_health(remote, cluster, retry): + # try this several times, since tell to mons is lossy. + args = 'sudo ceph --cluster {cluster} {retry_opts} tell mon.* injectargs -- --no-mon-health-to-clog' + try: + retry_opts = '--mon-client-directed-command-retry {}'.format(retry) + remote.run( + args=args.format(cluster=cluster, + retry_opts=retry_opts)) + except run.CommandFailedError: + for i in range(retry): + try: + remote.run( + args=args.format(cluster=cluster, + retry_opts='')) + return + except run.CommandFailedError: + pass + + @contextlib.contextmanager def task(ctx, config): """ @@ -1886,17 +1905,4 @@ def task(ctx, config): # a bunch of scary messages unrelated to our actual run. firstmon = teuthology.get_first_mon(ctx, config, config['cluster']) (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys() - # try this several times, since tell to mons is lossy. - mon0_remote.run( - args=[ - 'sudo', - 'ceph', - '--cluster', config['cluster'], - '--mon-client-directed-command-retry', '5', - 'tell', - 'mon.*', - 'injectargs', - '--', - '--no-mon-health-to-clog', - ] - ) + stop_logging_health(mon0_remote, config['cluster'], 5) -- 2.39.5