Skip to content

Commit cc481a6

Browse files
authored
Merge pull request ceph#60083 from phlogistonjohn/jjm-issue68322
cephadm: use a shared smb.conf for clustered smb container sets Reviewed-by: Adam King <[email protected]> Reviewed-by: Sachin Prabhu <[email protected]>
2 parents d53ffb1 + a92ca37 commit cc481a6

File tree

1 file changed

+26
-0
lines changed
  • src/cephadm/cephadmlib/daemons

1 file changed

+26
-0
lines changed

src/cephadm/cephadmlib/daemons/smb.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,18 @@ def customize_container_mounts(
714714
mounts[ctdb_run] = '/var/run/ctdb:z'
715715
mounts[ctdb_volatile] = '/var/lib/ctdb/volatile:z'
716716
mounts[ctdb_etc] = '/etc/ctdb:z'
717+
# create a shared smb.conf file for our clustered instances.
718+
# This is a HACK that substitutes for a bunch of architectural
719+
# changes to sambacc *and* smbmetrics (container). In short,
720+
# sambacc can set up the correct cluster enabled conf file for
721+
# samba daemons (smbd, winbindd, etc) but not it's own long running
722+
# tasks. Similarly, the smbmetrics container always uses the
723+
# registry conf (non-clustered). Having cephadm create a stub
724+
# config that will share the file across all containers is a
725+
# stopgap that resolves the problem for now, but should eventually
726+
# be replaced by a less "leaky" approach in the managed containers.
727+
ctdb_smb_conf = str(data_dir / 'ctdb/smb.conf')
728+
mounts[ctdb_smb_conf] = '/etc/samba/smb.conf:z'
717729

718730
def customize_container_endpoints(
719731
self, endpoints: List[EndPoint], deployment_type: DeploymentType
@@ -739,6 +751,7 @@ def prepare_data_dir(self, data_dir: str, uid: int, gid: int) -> None:
739751
file_utils.makedirs(ddir / 'ctdb/volatile', uid, gid, 0o770)
740752
file_utils.makedirs(ddir / 'ctdb/etc', uid, gid, 0o770)
741753
self._write_ctdb_stub_config(etc_samba_ctr / 'ctdb.json')
754+
self._write_smb_conf_stub(ddir / 'ctdb/smb.conf')
742755

743756
def _write_ctdb_stub_config(self, path: pathlib.Path) -> None:
744757
reclock_cmd = ' '.join(_MUTEX_SUBCMD + [self._cfg.cluster_lock_uri])
@@ -758,6 +771,19 @@ def _write_ctdb_stub_config(self, path: pathlib.Path) -> None:
758771
with file_utils.write_new(path) as fh:
759772
json.dump(stub_config, fh)
760773

774+
def _write_smb_conf_stub(self, path: pathlib.Path) -> None:
775+
"""Initialize a stub smb conf that will be shared by the primary
776+
and sidecar containers. This is expected to be overwritten by
777+
sambacc.
778+
"""
779+
_lines = [
780+
'[global]',
781+
'config backend = registry',
782+
]
783+
with file_utils.write_new(path) as fh:
784+
for line in _lines:
785+
fh.write(f'{line}\n')
786+
761787

762788
class _NetworkMapper:
763789
"""Helper class that maps between cephadm-friendly address-networks

0 commit comments

Comments
 (0)