From 3f5d3c458ab5f08685b76d6b4aa4aa37886bd812 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 15 Nov 2021 10:43:32 -0500 Subject: [PATCH] cephadm: only make_log_dir for ceph daemons For non-ceph daemons, (1) they don't log to /var/log/ceph, and (2) the container image isn't a ceph image, which means the uid/gid extraction won't have the correct uid/gid and we'll end up with a log directory that ceph daemons no longer have write permissions for. Fixes: https://tracker.ceph.com/issues/53257 Signed-off-by: Sage Weil (cherry picked from commit 393960c164bf84b21ffee6af65c19d968b416fb2) --- src/cephadm/cephadm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index ec8e4dba2c6bc..83ff82c0b300b 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2193,7 +2193,9 @@ def create_daemon_dirs(ctx, fsid, daemon_type, daemon_id, uid, gid, config=None, keyring=None): # type: (CephadmContext, str, str, Union[int, str], int, int, Optional[str], Optional[str]) -> None data_dir = make_data_dir(ctx, fsid, daemon_type, daemon_id, uid=uid, gid=gid) - make_log_dir(ctx, fsid, uid=uid, gid=gid) + + if daemon_type in Ceph.daemons: + make_log_dir(ctx, fsid, uid=uid, gid=gid) if config: config_path = os.path.join(data_dir, 'config') @@ -4664,8 +4666,6 @@ def command_shell(ctx): cp.get('global', 'fsid') != ctx.fsid: raise Error('fsid does not match ceph.conf') - if ctx.fsid: - make_log_dir(ctx, ctx.fsid) if ctx.name: if '.' in ctx.name: (daemon_type, daemon_id) = ctx.name.split('.', 1) @@ -4676,6 +4676,9 @@ def command_shell(ctx): daemon_type = 'osd' # get the most mounts daemon_id = None + if ctx.fsid and daemon_type in Ceph.daemons: + make_log_dir(ctx, ctx.fsid) + if daemon_id and not ctx.fsid: raise Error('must pass --fsid to specify cluster') -- 2.39.5