summaryrefslogtreecommitdiffstats
path: root/src/cephadm/cephadmlib/daemons/smb.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/cephadm/cephadmlib/daemons/smb.py')
-rw-r--r--src/cephadm/cephadmlib/daemons/smb.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/cephadm/cephadmlib/daemons/smb.py b/src/cephadm/cephadmlib/daemons/smb.py
index ae9acbc9c45..82f886e72ec 100644
--- a/src/cephadm/cephadmlib/daemons/smb.py
+++ b/src/cephadm/cephadmlib/daemons/smb.py
@@ -72,6 +72,7 @@ class Config:
instance_id: str
source_config: str
samba_debug_level: int
+ ctdb_log_level: str
debug_delay: int
domain_member: bool
clustered: bool
@@ -98,6 +99,7 @@ class Config:
domain_member: bool,
clustered: bool,
samba_debug_level: int = 0,
+ ctdb_log_level: str = '',
debug_delay: int = 0,
join_sources: Optional[List[str]] = None,
user_sources: Optional[List[str]] = None,
@@ -119,6 +121,7 @@ class Config:
self.domain_member = domain_member
self.clustered = clustered
self.samba_debug_level = samba_debug_level
+ self.ctdb_log_level = ctdb_log_level
self.debug_delay = debug_delay
self.join_sources = join_sources or []
self.user_sources = user_sources or []
@@ -370,6 +373,8 @@ class CTDBDaemonContainer(SambaContainerCommon):
# make conditional?
# CAP_NET_ADMIN is needed for event script to add public ips to iface
cargs.append('--cap-add=NET_ADMIN')
+ # CAP_NET_RAW allows to send gratuitous ARPs/tickle ACKs via raw sockets
+ cargs.append('--cap-add=NET_RAW')
return cargs
@@ -714,6 +719,18 @@ class SMB(ContainerDaemonForm):
mounts[ctdb_run] = '/var/run/ctdb:z'
mounts[ctdb_volatile] = '/var/lib/ctdb/volatile:z'
mounts[ctdb_etc] = '/etc/ctdb:z'
+ # create a shared smb.conf file for our clustered instances.
+ # This is a HACK that substitutes for a bunch of architectural
+ # changes to sambacc *and* smbmetrics (container). In short,
+ # sambacc can set up the correct cluster enabled conf file for
+ # samba daemons (smbd, winbindd, etc) but not it's own long running
+ # tasks. Similarly, the smbmetrics container always uses the
+ # registry conf (non-clustered). Having cephadm create a stub
+ # config that will share the file across all containers is a
+ # stopgap that resolves the problem for now, but should eventually
+ # be replaced by a less "leaky" approach in the managed containers.
+ ctdb_smb_conf = str(data_dir / 'ctdb/smb.conf')
+ mounts[ctdb_smb_conf] = '/etc/samba/smb.conf:z'
def customize_container_endpoints(
self, endpoints: List[EndPoint], deployment_type: DeploymentType
@@ -739,11 +756,12 @@ class SMB(ContainerDaemonForm):
file_utils.makedirs(ddir / 'ctdb/volatile', uid, gid, 0o770)
file_utils.makedirs(ddir / 'ctdb/etc', uid, gid, 0o770)
self._write_ctdb_stub_config(etc_samba_ctr / 'ctdb.json')
+ self._write_smb_conf_stub(ddir / 'ctdb/smb.conf')
def _write_ctdb_stub_config(self, path: pathlib.Path) -> None:
reclock_cmd = ' '.join(_MUTEX_SUBCMD + [self._cfg.cluster_lock_uri])
nodes_cmd = ' '.join(_NODES_SUBCMD)
- stub_config = {
+ stub_config: Dict[str, Any] = {
'samba-container-config': 'v0',
'ctdb': {
# recovery_lock is passed directly to ctdb: needs '!' prefix
@@ -755,9 +773,24 @@ class SMB(ContainerDaemonForm):
),
},
}
+ if self._cfg.ctdb_log_level:
+ stub_config['ctdb']['log_level'] = self._cfg.ctdb_log_level
with file_utils.write_new(path) as fh:
json.dump(stub_config, fh)
+ def _write_smb_conf_stub(self, path: pathlib.Path) -> None:
+ """Initialize a stub smb conf that will be shared by the primary
+ and sidecar containers. This is expected to be overwritten by
+ sambacc.
+ """
+ _lines = [
+ '[global]',
+ 'config backend = registry',
+ ]
+ with file_utils.write_new(path) as fh:
+ for line in _lines:
+ fh.write(f'{line}\n')
+
class _NetworkMapper:
"""Helper class that maps between cephadm-friendly address-networks