return mounts
-def get_container(fsid, daemon_type, daemon_id, privileged=False,
+def get_container(fsid, daemon_type, daemon_id,
+ privileged=False,
+ ptrace=False,
container_args=[]):
- # type: (str, str, Union[int, str], bool, List[str]) -> CephContainer
+ # type: (str, str, Union[int, str], bool, bool, List[str]) -> CephContainer
if daemon_type in ['mon', 'osd']:
# mon and osd need privileged in order for libudev to query devices
privileged = True
cname='ceph-%s-%s.%s' % (fsid, daemon_type, daemon_id),
envs=envs,
privileged=privileged,
+ ptrace=ptrace,
)
def extract_uid_gid(img='', file_path='/var/lib/ceph'):
cname='',
container_args=[],
envs=None,
- privileged=False):
- # type: (str, str, List[str], Dict[str, str], str, List[str], Optional[List[str]], Optional[bool]) -> None
+ privileged=False,
+ ptrace=False):
+ # type: (str, str, List[str], Dict[str, str], str, List[str], Optional[List[str]], bool, bool) -> None
self.image = image
self.entrypoint = entrypoint
self.args = args
self.volume_mounts = volume_mounts
self.cname = cname
self.container_args = container_args
- self.privileged = privileged
self.envs = envs
+ self.privileged = privileged
+ self.ptrace = ptrace
def run_cmd(self):
# type: () -> List[str]
priv = ['--privileged',
# let OSD etc read block devs that haven't been chowned
'--group-add=disk']
+ if self.ptrace:
+ priv.append('--cap-add=SYS_PTRACE')
vols = sum(
[['-v', '%s:%s' % (host_dir, container_dir)]
for host_dir, container_dir in self.volume_mounts.items()], [])
(config, keyring) = get_config_and_keyring()
(uid, gid) = extract_uid_gid()
make_var_run(args.fsid, uid, gid)
- c = get_container(args.fsid, daemon_type, daemon_id)
+ c = get_container(args.fsid, daemon_type, daemon_id,
+ ptrace=args.allow_ptrace)
deploy_daemon(args.fsid, daemon_type, daemon_id, c, uid, gid,
config=config, keyring=keyring,
osd_fsid=args.osd_fsid,
'--reconfig',
action='store_true',
help='Reconfigure a previously deployed daemon')
+ parser_deploy.add_argument(
+ '--allow-ptrace',
+ action='store_true',
+ help='Allow SYS_PTRACE on daemon container')
parser_check_host = subparsers.add_parser(
'check-host', help='check host configuration')
"name=epoch,type=CephInt,range=0,req=false",
"dump the latest MgrMap",
"mgr", "r")
-COMMAND("mgr fail name=who,type=CephString",
+COMMAND("mgr fail name=who,type=CephString,req=false",
"treat the named manager daemon as failed", "mgr", "rw")
COMMAND("mgr module ls",
"list active mgr modules", "mgr", "r")
'default': True,
'desc': 'log to the "cephadm" cluster log channel"',
},
+ {
+ 'name': 'allow_ptrace',
+ 'type': 'bool',
+ 'default': False,
+ 'desc': 'allow SYS_PTRACE capability on ceph containers',
+ 'long_desc': 'The SYS_PTRACE capability is needed to attach to a '
+ 'process with gdb or strace. Enabling this options '
+ 'can allow debugging daemons that encounter problems '
+ 'at runtime.',
+ },
]
def __init__(self, *args, **kwargs):
self.warn_on_stray_hosts = True
self.warn_on_stray_daemons = True
self.warn_on_failed_host_check = True
+ self.allow_ptrace = False
self._cons = {} # type: Dict[str, Tuple[remoto.backends.BaseConnection,remoto.backends.LegacyModuleExecute]]
if reconfig:
extra_args.append('--reconfig')
+ if self.allow_ptrace:
+ extra_args.append('--allow-ptrace')
self.log.info('%s daemon %s on %s' % (
'Reconfiguring' if reconfig else 'Deploying',