]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: only make_log_dir for ceph daemons
authorSage Weil <sage@newdream.net>
Mon, 15 Nov 2021 15:43:32 +0000 (10:43 -0500)
committerSebastian Wagner <sewagner@redhat.com>
Mon, 3 Jan 2022 13:59:54 +0000 (14:59 +0100)
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 <sage@newdream.net>
(cherry picked from commit 393960c164bf84b21ffee6af65c19d968b416fb2)

src/cephadm/cephadm

index ec8e4dba2c6bcbe0b7f39ac33a1a6567dc2e828d..83ff82c0b300b849e1331d2be0fc347b8c943db1 100755 (executable)
@@ -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')