From 67125c55437589a96e08dc341920540e00141aaf Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 1 Apr 2021 15:37:13 -0500 Subject: [PATCH] qa/tasks/cephadm: add apply() method/task Signed-off-by: Sage Weil (cherry picked from commit 05b3ce258547d64a094b786a969d2b79c48a466e) --- .../smoke-roleless/2-services/rgw.yaml | 15 ++++++--- qa/tasks/cephadm.py | 32 +++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/qa/suites/rados/cephadm/smoke-roleless/2-services/rgw.yaml b/qa/suites/rados/cephadm/smoke-roleless/2-services/rgw.yaml index fab3551c85315..161b15c770cf0 100644 --- a/qa/suites/rados/cephadm/smoke-roleless/2-services/rgw.yaml +++ b/qa/suites/rados/cephadm/smoke-roleless/2-services/rgw.yaml @@ -1,5 +1,12 @@ tasks: -- cephadm.shell: - host.a: - - ceph orch apply rgw foo --port=8000 "--placement=count-per-host:4 *" - - sleep 60 +- cephadm.apply: + specs: + - service_type: rgw + service_id: foo + placement: + count_per_host: 4 + host_pattern: "*" + spec: + rgw_frontend_port: 8000 +- sleep: + interval: 60 diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 33bc9e4f922ac..01d49a7f3acbe 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -956,6 +956,38 @@ def shell(ctx, config): ['bash', '-c', c], extra_cephadm_args=env) +def apply(ctx, config): + """ + Apply spec + + tasks: + - cephadm.apply: + specs: + - service_type: rgw + service_id: foo + spec: + rgw_frontend_port: 8000 + - service_type: rgw + service_id: bar + spec: + rgw_frontend_port: 9000 + zone: bar + realm: asdf + + """ + cluster_name = config.get('cluster', 'ceph') + + specs = config.get('specs', []) + y = '\n---\n'.join(map(yaml.dump, specs)) + + log.info(f'Applying spec:\n{y}') + _shell( + ctx, cluster_name, ctx.ceph[cluster_name].bootstrap_remote, + ['ceph', 'orch', 'apply', '-i', '-'], + stdin=y, + ) + + @contextlib.contextmanager def tweaked_option(ctx, config): """ -- 2.39.5