From: Sage Weil Date: Mon, 8 Mar 2021 19:18:04 +0000 (-0500) Subject: cephadm: populate ports if known and not included in unit.meta X-Git-Tag: v16.2.0~73^2~41 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2a604b948fed202d6641097d5dbc57843cb6b606;p=ceph.git cephadm: populate ports if known and not included in unit.meta This is only helpful for daemons deployed by older versions of cephadm that have known ports based on their type. Signed-off-by: Sage Weil (cherry picked from commit 624e0d3356134e5a0e072150e8f4bdebec469b13) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 5c84da49d950c..ec656421b0f47 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2549,7 +2549,7 @@ def deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid, else: if c: deploy_daemon_units(ctx, fsid, uid, gid, daemon_type, daemon_id, - c, osd_fsid=osd_fsid) + c, osd_fsid=osd_fsid, ports=ports) else: raise RuntimeError('attempting to deploy a daemon without a container image') @@ -2613,6 +2613,7 @@ def deploy_daemon_units( enable: bool = True, start: bool = True, osd_fsid: Optional[str] = None, + ports: Optional[List[int]] = None, ) -> None: # cmd data_dir = get_data_dir(fsid, ctx.data_dir, daemon_type, daemon_id) @@ -2674,6 +2675,8 @@ def deploy_daemon_units( 'memory_request': int(ctx.memory_request) if ctx.memory_request else None, 'memory_limit': int(ctx.memory_limit) if ctx.memory_limit else None, }) + if not meta.get('ports'): + meta['ports'] = ports metaf.write(json.dumps(meta, indent=4) + '\n') os.fchmod(f.fileno(), 0o600)