]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: Add --container-image
authorSebastian Wagner <sebastian.wagner@suse.com>
Wed, 26 Aug 2020 12:45:34 +0000 (14:45 +0200)
committerNathan Cutler <ncutler@suse.com>
Tue, 6 Oct 2020 09:40:53 +0000 (11:40 +0200)
The kernel treats any process with PID 1 different. Especially
it does not generate a core dump. Call podman / docker with
--init in order to get core dumps.

In addition, we can now properly reap zombies processes.

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit 786e1c175b41d07d8eb3d86156d77e7769ae92ac)

doc/man/8/cephadm.rst
src/cephadm/cephadm

index 3b93150001e2ac1665d1d897377d7743cd3b915b..982a01f1bfd948d1a6d2824e66345e37de34126c 100644 (file)
@@ -77,6 +77,7 @@ Synopsis
 |                           [--registry-username REGISTRY_USERNAME]
 |                           [--registry-password REGISTRY_PASSWORD]
 |                           [--registry-json REGISTRY_JSON]
+|                           [--container-init]
 
 
 
@@ -84,6 +85,7 @@ Synopsis
 |                        [--config-json CONFIG_JSON] [--keyring KEYRING]
 |                        [--key KEY] [--osd-fsid OSD_FSID] [--skip-firewalld]
 |                        [--tcp-ports TCP_PORTS] [--reconfig] [--allow-ptrace]
+|                        [--container-init]
 
 | **cephadm** **check-host** [-h] [--expect-hostname EXPECT_HOSTNAME]
 
@@ -235,6 +237,8 @@ Arguments:
 * [--registry-username REGISTRY_USERNAME] username of account to login to on custom registry
 * [--registry-password REGISTRY_PASSWORD] password of account to login to on custom registry
 * [--registry-json REGISTRY_JSON] JSON file containing registry login info (see registry-login command documentation)
+* [--container-init]              Run podman/docker with `--init`
+
 
 ceph-volume
 -----------
@@ -284,6 +288,7 @@ Arguments:
 * [--tcp-ports                List of tcp ports to open in the host firewall
 * [--reconfig]                Reconfigure a previously deployed daemon
 * [--allow-ptrace]            Allow SYS_PTRACE on daemon container
+* [--container-init]          Run podman/docker with `--init`
 
 
 enter
index f4723ba9a26c98d624b5f42f43ef3aa7239a0251..1b524217cba82db533c8b93de66760690fb1c6ca 100755 (executable)
@@ -1883,6 +1883,7 @@ def get_container(fsid, daemon_type, daemon_id,
         envs=envs,
         privileged=privileged,
         ptrace=ptrace,
+        init=args.container_init,
     )
 
 
@@ -2348,8 +2349,10 @@ class CephContainer:
                  envs=None,
                  privileged=False,
                  ptrace=False,
-                 bind_mounts=None):
-        # type: (str, str, List[str], Dict[str, str], str, List[str], Optional[List[str]], bool, bool, Optional[List[List[str]]]) -> None
+                 bind_mounts=None,
+                 init=False,
+                 ):
+        # type: (str, str, List[str], Dict[str, str], str, List[str], Optional[List[str]], bool, bool, Optional[List[List[str]]], bool) -> None
         self.image = image
         self.entrypoint = entrypoint
         self.args = args
@@ -2360,6 +2363,7 @@ class CephContainer:
         self.privileged = privileged
         self.ptrace = ptrace
         self.bind_mounts = bind_mounts if bind_mounts else []
+        self.init = init
 
     def run_cmd(self):
         # type: () -> List[str]
@@ -2378,6 +2382,7 @@ class CephContainer:
                     '--group-add=disk']
         if self.ptrace:
             priv.append('--cap-add=SYS_PTRACE')
+        init = ['--init'] if self.init else []
         vols = sum(
             [['-v', '%s:%s' % (host_dir, container_dir)]
              for host_dir, container_dir in self.volume_mounts.items()], [])
@@ -2398,7 +2403,7 @@ class CephContainer:
             '--net=host',
             '--ipc=host',
         ] + self.container_args + priv + \
-        cname + envs + \
+        cname + init + envs + \
         vols + binds + entrypoint + \
         [
             self.image
@@ -5660,6 +5665,10 @@ def _get_parser():
     parser_bootstrap.add_argument(
         '--registry-json',
         help='json file with custom registry login info (URL, Username, Password)')
+    parser_bootstrap.add_argument(
+        '--container-init',
+        action='store_true',
+        help='Run podman/docker with `--init`')
 
     parser_deploy = subparsers.add_parser(
         'deploy', help='deploy a daemon')
@@ -5703,6 +5712,10 @@ def _get_parser():
         '--allow-ptrace',
         action='store_true',
         help='Allow SYS_PTRACE on daemon container')
+    parser_deploy.add_argument(
+        '--container-init',
+        action='store_true',
+        help='Run podman/docker with `--init`')
 
     parser_check_host = subparsers.add_parser(
         'check-host', help='check host configuration')