]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: unit.run: create /var/run/ceph/$FSID before doing anything else
authorTim Serong <tserong@suse.com>
Tue, 8 Sep 2020 10:50:35 +0000 (20:50 +1000)
committerNathan Cutler <ncutler@suse.com>
Tue, 6 Oct 2020 09:40:52 +0000 (11:40 +0200)
This ensures the /var/run/ceph/$FSID directory exists before any
other commands are run.

Fixes: https://tracker.ceph.com/issues/47360
Signed-off-by: Tim Serong <tserong@suse.com>
(cherry picked from commit 721b4de3490c739635d8cf6623f36d142acb8fac)

src/cephadm/cephadm

index 20c5652dc46b0fa13d77e702967616d26428a54b..9a42fd9da37b1c31e74e24d5e0b30897be928a23 100755 (executable)
@@ -2016,6 +2016,11 @@ def deploy_daemon_units(fsid, uid, gid, daemon_type, daemon_id, c,
     data_dir = get_data_dir(fsid, daemon_type, daemon_id)
     with open(data_dir + '/unit.run.new', 'w') as f:
         f.write('set -e\n')
+
+        if daemon_type in Ceph.daemons:
+            install_path = find_program('install')
+            f.write('{install_path} -d -m0770 -o {uid} -g {gid} /var/run/ceph/{fsid}\n'.format(install_path=install_path, fsid=fsid, uid=uid, gid=gid))
+
         # pre-start cmd(s)
         if daemon_type == 'osd':
             # osds have a pre-start step
@@ -2053,10 +2058,6 @@ def deploy_daemon_units(fsid, uid, gid, daemon_type, daemon_id, c,
             tcmu_container = ceph_iscsi.get_tcmu_runner_container()
             _write_container_cmd_to_bash(f, tcmu_container, 'iscsi tcmu-runnter container', background=True)
 
-        if daemon_type in Ceph.daemons:
-            install_path = find_program('install')
-            f.write('{install_path} -d -m0770 -o {uid} -g {gid} /var/run/ceph/{fsid}\n'.format(install_path=install_path, fsid=fsid, uid=uid, gid=gid))
-
         _write_container_cmd_to_bash(f, c, '%s.%s' % (daemon_type, str(daemon_id)))
         os.fchmod(f.fileno(), 0o600)
         os.rename(data_dir + '/unit.run.new',