From 533931505272d215a1b4fa40b3bf235cf2110102 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 26 Aug 2020 14:53:09 +0200 Subject: [PATCH] mgr/cephadm: Call cephadm with --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. Fixes: https://tracker.ceph.com/issues/44231 Signed-off-by: Sebastian Wagner --- doc/man/8/cephadm.rst | 1 + src/cephadm/cephadm | 7 +++++++ src/pybind/mgr/cephadm/module.py | 11 +++++++++++ 3 files changed, 19 insertions(+) diff --git a/doc/man/8/cephadm.rst b/doc/man/8/cephadm.rst index 982a01f1bfd9..5a1da7a040e3 100644 --- a/doc/man/8/cephadm.rst +++ b/doc/man/8/cephadm.rst @@ -28,6 +28,7 @@ Synopsis | **cephadm** **adopt** [-h] --name NAME --style STYLE [--cluster CLUSTER] | [--legacy-dir LEGACY_DIR] [--config-json CONFIG_JSON] | [--skip-firewalld] [--skip-pull] +| [--container-init] | **cephadm** **rm-daemon** [-h] --name NAME --fsid FSID [--force] | [--force-delete-data] diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 2c4b7d417084..7b524f3f80f3 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2942,6 +2942,9 @@ def command_bootstrap(): cli(['config', 'set', 'mgr', 'mgr/cephadm/registry_username', args.registry_username, '--force']) cli(['config', 'set', 'mgr', 'mgr/cephadm/registry_password', args.registry_password, '--force']) + if args.container_init: + cli(['config', 'set', 'mgr', 'mgr/cephadm/container_init', args.container_init, '--force']) + if not args.skip_dashboard: # Configure SSL port (cephadm only allows to configure dashboard SSL port) # if the user does not want to use SSL he can change this setting once the cluster is up @@ -5297,6 +5300,10 @@ def _get_parser(): '--force-start', action='store_true', help="start newly adoped daemon, even if it wasn't running previously") + parser_adopt.add_argument( + '--container-init', + action='store_true', + help='Run podman/docker with `--init`') parser_rm_daemon = subparsers.add_parser( 'rm-daemon', help='remove daemon instance') diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 149140a540ff..140a5b500fa7 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -205,6 +205,12 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, 'can allow debugging daemons that encounter problems ' 'at runtime.', }, + { + 'name': 'container_init', + 'type': 'bool', + 'default': False, + 'desc': 'Run podman/docker with `--init`', + }, { 'name': 'prometheus_alerts_path', 'type': 'str', @@ -280,6 +286,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, self.warn_on_stray_daemons = True self.warn_on_failed_host_check = True self.allow_ptrace = False + self.container_init = False self.prometheus_alerts_path = '' self.migration_current = None self.config_dashboard = True @@ -1118,6 +1125,10 @@ you may want to run: if not no_fsid: final_args += ['--fsid', self._cluster_fsid] + + if self.container_init: + final_args += ['--container-init'] + final_args += args self.log.debug('args: %s' % (' '.join(final_args))) -- 2.47.3