From: John Mulligan Date: Wed, 11 Jun 2025 18:58:24 +0000 (-0400) Subject: mgr/smb: update handler.py to make use of the cluster custom ports value X-Git-Tag: v21.0.0~256^2~276^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=77b0412e31a29b76aff2778817c01256a89e9e26;p=ceph.git 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 --- diff --git a/src/pybind/mgr/smb/handler.py b/src/pybind/mgr/smb/handler.py index e0dc95189025..cb690fc387d8 100644 --- a/src/pybind/mgr/smb/handler.py +++ b/src/pybind/mgr/smb/handler.py @@ -1262,6 +1262,10 @@ def _generate_config( cluster_global_opts['workgroup'] = wg cluster_global_opts['idmap config * : backend'] = 'autorid' cluster_global_opts['idmap config * : range'] = '2000-9999999' + if cluster.is_clustered() and cluster.custom_ports: + # a ctdb enabled cluster (w/ host networking) with custom ports needs + # to change the port at the smbd level + cluster_global_opts['smb ports'] = str(_smb_port(cluster)) share_configs = { share.name: _generate_share(share, resolver, cephx_entity) @@ -1355,6 +1359,7 @@ def _generate_smb_service_spec( custom_dns=cluster.custom_dns, include_ceph_users=user_entities, cluster_public_addrs=cluster.service_spec_public_addrs(), + custom_ports=cluster.custom_ports, ) @@ -1489,3 +1494,7 @@ def _has_proxied_vfs(change_group: ClusterChangeGroup) -> bool: == CephFSStorageProvider.SAMBA_VFS_PROXIED for s in change_group.shares ) + + +def _smb_port(cluster: resources.Cluster, default: int = 445) -> int: + return (cluster.custom_ports or {}).get("smb", default)