From 32e06caa35e60cf816f655bd6079d7fbe0314eb2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 6 Dec 2019 15:14:31 -0600 Subject: [PATCH] ceph-daemon: fix bootstrap ownership of tmp monmap file The file is created with mode 0644 by the ceph:ceph user, but root cannot write to that. Instead, create the tmp file owned by root, write to it, then chown it to user ceph. Fixes e92929d86dce2297d3e02ec88c6830224aefc061 Signed-off-by: Sage Weil --- src/ceph-daemon/ceph-daemon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ceph-daemon/ceph-daemon b/src/ceph-daemon/ceph-daemon index 7edfccc4632b3..3795f39653664 100755 --- a/src/ceph-daemon/ceph-daemon +++ b/src/ceph-daemon/ceph-daemon @@ -1066,7 +1066,7 @@ def command_bootstrap(): # create initial monmap, tmp monmap file logger.info('Creating initial monmap...') - tmp_monmap = write_tmp('', uid, gid) + tmp_monmap = write_tmp('', 0, 0) out = CephContainer( image=args.image, entrypoint='/usr/bin/monmaptool', @@ -1081,6 +1081,9 @@ def command_bootstrap(): }, ).run() + # pass monmap file to ceph user for use by ceph-mon --mkfs below + os.fchown(tmp_monmap.fileno(), uid, gid) + # create mon logger.info('Creating mon...') create_daemon_dirs(fsid, 'mon', mon_id, uid, gid) -- 2.39.5