Skip to content

Commit

Permalink
Merge pull request ceph#60083 from phlogistonjohn/jjm-issue68322
Browse files Browse the repository at this point in the history
cephadm: use a shared smb.conf for clustered smb container sets

Reviewed-by: Adam King <[email protected]>
Reviewed-by: Sachin Prabhu <[email protected]>
  • Loading branch information
adk3798 authored Oct 3, 2024
2 parents d53ffb1 + a92ca37 commit cc481a6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/cephadm/cephadmlib/daemons/smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,18 @@ def customize_container_mounts(
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
Expand All @@ -739,6 +751,7 @@ def prepare_data_dir(self, data_dir: str, uid: int, gid: int) -> None:
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])
Expand All @@ -758,6 +771,19 @@ def _write_ctdb_stub_config(self, path: pathlib.Path) -> None:
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
Expand Down

0 comments on commit cc481a6

Please sign in to comment.