From: Sebastian Wagner Date: Wed, 26 Aug 2020 12:45:34 +0000 (+0200) Subject: cephadm: Add --container-image X-Git-Tag: v15.2.9~122^2~44^2~38 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=20dcb1e02c56a8acaad2719cc74cdb415b3a59b4;p=ceph.git cephadm: Add --container-image 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 (cherry picked from commit 786e1c175b41d07d8eb3d86156d77e7769ae92ac) --- diff --git a/doc/man/8/cephadm.rst b/doc/man/8/cephadm.rst index 3b93150001e..982a01f1bfd 100644 --- a/doc/man/8/cephadm.rst +++ b/doc/man/8/cephadm.rst @@ -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 diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index f4723ba9a26..1b524217cba 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -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')