From: Sage Weil Date: Tue, 23 Feb 2021 17:25:37 +0000 (-0500) Subject: cephadm: accept arbitrary dict via --meta-json X-Git-Tag: v16.2.0~119^2~34 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=18e050fe1b8039afc1ccf0992ef58d0630f38288;p=ceph.git cephadm: accept arbitrary dict via --meta-json e.g., --meta-json '{"foo": "bar"}' Signed-off-by: Sage Weil (cherry picked from commit f58485efb66548f2f7acd94e448e160480775f81) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 64299eabe075..e316f0a7b94e 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2635,10 +2635,14 @@ def deploy_daemon_units( _write_container_cmd_to_bash(ctx, f, c, '%s.%s' % (daemon_type, str(daemon_id))) # some metadata about the deploy - metaf.write(json.dumps({ + meta: Dict[str, Any] = {} + if 'meta_json' in ctx and ctx.meta_json: + meta = json.loads(ctx.meta_json) or {} + meta.update({ 'memory_request': int(ctx.memory_request) if ctx.memory_request else None, 'memory_limit': int(ctx.memory_limit) if ctx.memory_limit else None, - }, indent=4) + "\n") + }) + metaf.write(json.dumps(meta, indent=4) + "\n") os.fchmod(f.fileno(), 0o600) os.fchmod(metaf.fileno(), 0o600) @@ -7606,6 +7610,10 @@ def _get_parser(): '--memory-limit', help='Container memory hard limit' ) + parser_deploy.add_argument( + '--meta-json', + help='JSON dict of additional metadata' + ) parser_check_host = subparsers.add_parser( 'check-host', help='check host configuration')