Skip to content

Commit 82b299c

Browse files
committed
smb: Update the configuration logic for smbd ports
This change lets us switch the default listening ports (445 and 139) for smbd to a custom configured port or to 445 when host networking is disabled. Previously, with host networking off, the legacy port 139 was never published even though the daemon was listening on it inside the container. For consistency, regardless of whether a custom SMB port is set, the `smb ports` parameter in smb.conf is used. Since the SMB daemon publishes whatever port is defined in the configuration, it makes sense to remove the checks for clustered and custom ports while adding the `smb ports` parameter. Signed-off-by: Anoop C S <[email protected]>
1 parent 4d2729d commit 82b299c

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/cephadm/cephadmlib/daemons/smb.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,8 @@ def container_args(self) -> List[str]:
337337
# networking) and need to publish ports via podman/docker.
338338
# All published ports happen at the primary container.
339339
if self.cfg.smb_port:
340-
cargs.extend(
341-
self._publish(self.cfg.smb_port, Ports.SMB.value)
342-
)
340+
smb_port = self.cfg.smb_port
341+
cargs.extend(self._publish(smb_port, smb_port))
343342
if self.cfg.metrics_port:
344343
metrics_port = self.cfg.metrics_port
345344
cargs.extend(self._publish(metrics_port, metrics_port))

src/pybind/mgr/smb/handler.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -793,10 +793,7 @@ def _generate_config(
793793
cluster_global_opts['workgroup'] = wg
794794
cluster_global_opts['idmap config * : backend'] = 'autorid'
795795
cluster_global_opts['idmap config * : range'] = '2000-9999999'
796-
if cluster.is_clustered() and cluster.custom_ports:
797-
# a ctdb enabled cluster (w/ host networking) with custom ports needs
798-
# to change the port at the smbd level
799-
cluster_global_opts['smb ports'] = str(_smb_port(cluster))
796+
cluster_global_opts['smb ports'] = str(_smb_port(cluster))
800797

801798
share_configs = {
802799
share.name: _generate_share(share, resolver, cephx_entity)

0 commit comments

Comments
 (0)