From 721b4de3490c739635d8cf6623f36d142acb8fac Mon Sep 17 00:00:00 2001 From: Tim Serong Date: Tue, 8 Sep 2020 20:50:35 +1000 Subject: [PATCH] cephadm: unit.run: create /var/run/ceph/$FSID before doing anything else 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 --- src/cephadm/cephadm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index ac44cb57d5317..4cdd5e4966d2d 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -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', -- 2.39.5