]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: unit.run: add `set -e`
authorSebastian Wagner <sebastian.wagner@suse.com>
Thu, 18 Jun 2020 14:13:00 +0000 (16:13 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 14 Jul 2020 09:39:06 +0000 (11:39 +0200)
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 <sebastian.wagner@suse.com>
(cherry picked from commit f9e5dd509bcc5d5b7c9849f58183a9de6f56ee1e)

src/cephadm/cephadm

index 067ac5b145ffbe859f54e3c3a495be3dcd1492d3..ea231f880d0b376e3f794a1c07705446fb60ab32 100755 (executable)
@@ -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')