]> git.apps.os.sepia.ceph.com Git - ceph-ci.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)
committerTim Serong <tserong@suse.com>
Tue, 8 Sep 2020 10:51:23 +0000 (20:51 +1000)
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>
src/cephadm/cephadm

index ac44cb57d5317042a1086181f49deb2544c2a0d8..4cdd5e4966d2dcdd42e7b3f66006dc64dfa8ddc5 100755 (executable)
@@ -1984,6 +1984,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
@@ -2021,10 +2026,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',