From 186befcc6239ec3322483f949e055a926f2ad5ce Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Thu, 18 Jun 2020 16:13:00 +0200 Subject: [PATCH] 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) --- src/cephadm/cephadm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 067ac5b145ffb..ea231f880d0b3 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') -- 2.39.5