From: John Mulligan Date: Wed, 26 Nov 2025 19:59:50 +0000 (-0500) Subject: mgr/smb: add new external ceph cluster resource type X-Git-Tag: testing/wip-vshankar-testing-20260222.101816~7^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e64a83965145c0f58677668e184dd748f3593a2c;p=ceph-ci.git mgr/smb: add new external ceph cluster resource type Add a new resource type that will allow an smb cluster to use cephfs from a ceph cluster *other* than the one hosting the smb instance. Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/smb/resources.py b/src/pybind/mgr/smb/resources.py index c43655b6cb8..beeb279e741 100644 --- a/src/pybind/mgr/smb/resources.py +++ b/src/pybind/mgr/smb/resources.py @@ -515,6 +515,27 @@ class TLSSource(_RBase): return rc +@resourcelib.component() +class ExternalCephClusterSource(_RBase): + """References Ceph cluster configurations for clusters other than the + current cluster. + """ + + source_type: SourceReferenceType = SourceReferenceType.RESOURCE + ref: str = '' + + def validate(self) -> None: + if not self.ref: + raise ValueError('reference value must be specified') + else: + validation.check_id(self.ref) + + @resourcelib.customize + def _customize_resource(rc: resourcelib.Resource) -> resourcelib.Resource: + rc.ref.quiet = True + return rc + + @resourcelib.component() class RemoteControl(_RBase): # enabled can be set to explicitly toggle the remote control server @@ -559,6 +580,9 @@ class Cluster(_RBase): bind_addrs: Optional[List[ClusterBindIP]] = None # configure a remote control sidecar server. remote_control: Optional[RemoteControl] = None + # connect the smb cluster and all its shares to cephfs file systems + # hosted on an external ceph cluster + external_ceph_cluster: Optional[ExternalCephClusterSource] = None def validate(self) -> None: if not self.cluster_id: @@ -751,6 +775,41 @@ class TLSCredential(_RBase): return self +@resourcelib.component() +class CephUserKey(_RBase): + """A Ceph User Key name and value pair.""" + + name: str + key: str + + +@resourcelib.component() +class ExternalCephClusterValues(_RBase): + """Contains values that can be used to connect to a Ceph cluster + other than the current cluster. + """ + + fsid: str + mon_host: str + cephfs_user: CephUserKey + + +@resourcelib.resource('ceph.smb.ext.cluster') +class ExternalCephCluster(_RBase): + """Resource used to configure an external Ceph cluster.""" + + external_ceph_cluster_id: str + intent: Intent = Intent.PRESENT + cluster: Optional[ExternalCephClusterValues] = None + + def validate(self) -> None: + if not self.external_ceph_cluster_id: + raise ValueError('external_ceph_cluster_id requires a value') + validation.check_id(self.external_ceph_cluster_id) + if self.intent is Intent.PRESENT and not self.cluster: + raise ValueError('cluster parameter must be specified') + + # SMBResource is a union of all valid top-level smb resource types. SMBResource = Union[ Cluster, @@ -760,6 +819,7 @@ SMBResource = Union[ Share, UsersAndGroups, TLSCredential, + ExternalCephCluster, ]