]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemon: fix bootstrap ownership of tmp monmap file 32097/head
authorSage Weil <sage@redhat.com>
Fri, 6 Dec 2019 21:14:31 +0000 (15:14 -0600)
committerSage Weil <sage@redhat.com>
Fri, 6 Dec 2019 21:14:31 +0000 (15:14 -0600)
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 <sage@redhat.com>
src/ceph-daemon/ceph-daemon

index 7edfccc4632b38de36b3e386110d10be953ed2ec..3795f396536649159d2fe1b55fac540b68d96b92 100755 (executable)
@@ -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)