Skip to content

Commit 77b0412

Browse files
mgr/smb: update handler.py to make use of the cluster custom ports value
When a custom_ports field on the Cluster type is provided pass it to the smb service spec and smb/sambacc configuration fields needed. Signed-off-by: John Mulligan <[email protected]>
1 parent cec3bc6 commit 77b0412

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/pybind/mgr/smb/handler.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,10 @@ def _generate_config(
12621262
cluster_global_opts['workgroup'] = wg
12631263
cluster_global_opts['idmap config * : backend'] = 'autorid'
12641264
cluster_global_opts['idmap config * : range'] = '2000-9999999'
1265+
if cluster.is_clustered() and cluster.custom_ports:
1266+
# a ctdb enabled cluster (w/ host networking) with custom ports needs
1267+
# to change the port at the smbd level
1268+
cluster_global_opts['smb ports'] = str(_smb_port(cluster))
12651269

12661270
share_configs = {
12671271
share.name: _generate_share(share, resolver, cephx_entity)
@@ -1355,6 +1359,7 @@ def _generate_smb_service_spec(
13551359
custom_dns=cluster.custom_dns,
13561360
include_ceph_users=user_entities,
13571361
cluster_public_addrs=cluster.service_spec_public_addrs(),
1362+
custom_ports=cluster.custom_ports,
13581363
)
13591364

13601365

@@ -1489,3 +1494,7 @@ def _has_proxied_vfs(change_group: ClusterChangeGroup) -> bool:
14891494
== CephFSStorageProvider.SAMBA_VFS_PROXIED
14901495
for s in change_group.shares
14911496
)
1497+
1498+
1499+
def _smb_port(cluster: resources.Cluster, default: int = 445) -> int:
1500+
return (cluster.custom_ports or {}).get("smb", default)

0 commit comments

Comments
 (0)