Merge PR #40602 into master

* refs/pull/40602/head:
	qa/tasks/cephadm: add apply() method/task

Reviewed-by: Sebastian Wagner <swagner@suse.com>
This commit is contained in:
Sage Weil 2021-04-06 16:04:27 -04:00
commit 3b391cbf7a
2 changed files with 43 additions and 4 deletions

View File

@ -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

View File

@ -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):
"""