From: Sage Weil Date: Tue, 23 Feb 2021 17:25:37 +0000 (-0500) Subject: cephadm: accept arbitrary dict via --meta-json X-Git-Tag: v17.1.0~2823^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f58485efb66548f2f7acd94e448e160480775f81;p=ceph-ci.git cephadm: accept arbitrary dict via --meta-json e.g., --meta-json '{"foo": "bar"}' Signed-off-by: Sage Weil --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 59d1b5d6ed4..477ebfe6161 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2626,10 +2626,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) @@ -7595,6 +7599,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')