]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: Manually remove containers 35018/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Tue, 12 May 2020 12:07:32 +0000 (14:07 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 14 May 2020 11:36:00 +0000 (13:36 +0200)
This fixes:
```
Error: error creating container storage: the container name "ceph-<fsid>-mon.b" is already in use by "<container-id>". You have to remove that container to be able to reuse that name.: that name is already in use
```

Relates to https://tracker.ceph.com/issues/44990

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/cephadm/cephadm

index 8c47c443299285857efd2ecfc04e885581d33cf8..d219ae90ee8bc65e199d429d459cb8da3721381c 100755 (executable)
@@ -1853,6 +1853,9 @@ def deploy_daemon_units(fsid, uid, gid, daemon_type, daemon_id, c,
             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))
 
+        # Sometimes, adding `--rm` to a run_cmd doesn't work. Let's remove the container manually
+        f.write(' '.join(c.rm_cmd()) + '\n')
+
         # container run command
         f.write(' '.join(c.run_cmd()) + '\n')
         os.fchmod(f.fileno(), 0o600)
@@ -2177,6 +2180,14 @@ class CephContainer:
             self.cname,
         ] + cmd
 
+    def rm_cmd(self):
+        # type: () -> List[str]
+        return [
+            str(container_path),
+            'rm', '-f',
+            self.cname
+        ]
+
     def run(self, timeout=DEFAULT_TIMEOUT):
         # type: (Optional[int]) -> str
         logger.debug(self.run_cmd())