From f58485efb66548f2f7acd94e448e160480775f81 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 Feb 2021 12:25:37 -0500 Subject: [PATCH] cephadm: accept arbitrary dict via --meta-json e.g., --meta-json '{"foo": "bar"}' Signed-off-by: Sage Weil --- src/cephadm/cephadm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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') -- 2.39.5