From: Sebastian Wagner Date: Thu, 18 Jun 2020 14:13:00 +0000 (+0200) Subject: cephadm: unit.run: add `set -e` X-Git-Tag: v15.2.5~147^2~31 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=186befcc6239ec3322483f949e055a926f2ad5ce;p=ceph.git cephadm: unit.run: add `set -e` In case LVM activates fails for some unknown reason, prevent the script from continuing with starting the OSD container. This leads to faild systemd services with active OSD containers. Fixes: https://tracker.ceph.com/issues/46036 Signed-off-by: Sebastian Wagner (cherry picked from commit f9e5dd509bcc5d5b7c9849f58183a9de6f56ee1e) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 067ac5b145ff..ea231f880d0b 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -1881,6 +1881,7 @@ def deploy_daemon_units(fsid, uid, gid, daemon_type, daemon_id, c, # cmd 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') # pre-start cmd(s) if daemon_type == 'osd': # osds have a pre-start step @@ -1917,10 +1918,10 @@ def deploy_daemon_units(fsid, uid, gid, daemon_type, daemon_id, c, 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)) # Sometimes, adding `--rm` to a run_cmd doesn't work. Let's remove the container manually - f.write(' '.join(c.rm_cmd()) + '\n') + f.write('! '+ ' '.join(c.rm_cmd()) + '\n') # Sometimes, `podman rm` doesn't find the container. Then you'll have to add `--storage` if 'podman' in container_path: - f.write(' '.join(c.rm_cmd(storage=True)) + '\n') + f.write('! '+ ' '.join(c.rm_cmd(storage=True)) + '\n') # container run command f.write(' '.join(c.run_cmd()) + '\n')