]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: allow redeploy of daemons in error state if container running
authorAdam King <adking@redhat.com>
Mon, 8 Feb 2021 19:55:45 +0000 (14:55 -0500)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 23 Feb 2021 09:59:23 +0000 (10:59 +0100)
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 71613e61fa66e3479693f61ce63732550f756e17)

src/cephadm/cephadm

index d621b5ae88634637d1eac0fbaed42d87ff2d4312..1e7748008b3587e7b8890731d949327296a3e40e 100755 (executable)
@@ -1977,6 +1977,13 @@ def check_units(ctx, units, enabler=None):
     return False
 
 
+def is_container_running(ctx: CephadmContext, name: str) -> bool:
+    out, err, ret = call_throws(ctx, [
+        ctx.container_path, 'ps',
+        '--format', '{{.Names}}'])
+    return name in out
+
+
 def get_legacy_config_fsid(cluster, legacy_dir=None):
     # type: (str, Optional[str]) -> Optional[str]
     config_file = '/etc/ceph/%s.conf' % cluster
@@ -3983,8 +3990,9 @@ def command_deploy(ctx):
 
     redeploy = False
     unit_name = get_unit_name(ctx.fsid, daemon_type, daemon_id)
+    container_name = 'ceph-%s-%s.%s' % (ctx.fsid, daemon_type, daemon_id)
     (_, state, _) = check_unit(ctx, unit_name)
-    if state == 'running':
+    if state == 'running' or is_container_running(ctx, container_name):
         redeploy = True
 
     if ctx.reconfig: