From: John Mulligan Date: Wed, 3 Dec 2025 19:35:10 +0000 (-0500) Subject: mgr/smb: add external ceph cluster to sqlite store X-Git-Tag: testing/wip-vshankar-testing-20260222.101816~7^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=24a2e25fef0ae7a121a74410221b057fdb2bcf2c;p=ceph-ci.git mgr/smb: add external ceph cluster to sqlite store Starting to get silly with the boilerplate but it should do the trick. Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/smb/sqlite_store.py b/src/pybind/mgr/smb/sqlite_store.py index d68fd2da28a..0f01aa5f5b0 100644 --- a/src/pybind/mgr/smb/sqlite_store.py +++ b/src/pybind/mgr/smb/sqlite_store.py @@ -520,6 +520,21 @@ class MirrorTLSCredentials(Mirror): return filtered +class MirrorExternalCephCluster(Mirror): + """Mirroring configuration for objects in the ext_ceph_clusters namespace.""" + + def __init__(self, store: ConfigStore) -> None: + super().__init__('ext_ceph_clusters', store) + + def filter_object(self, obj: Simplified) -> Simplified: + """Filter ext_ceph_clusters for sqlite3 store.""" + filtered = copy.deepcopy(obj) + cu = filtered.get('cluster', {}).get('cephfs_user') + if cu: + cu.pop('key', None) + return filtered + + def _tables( *, specialize: bool = True, @@ -541,6 +556,7 @@ def _tables( SimpleTable('join_auths', 'join_auths'), SimpleTable('users_and_groups', 'users_and_groups'), SimpleTable('tls_creds', 'tls_creds'), + SimpleTable('ext_ceph_clusters', 'ext_ceph_clusters'), ] @@ -560,6 +576,12 @@ def _mirror_tls_credentials(opts: Optional[Dict[str, str]] = None) -> bool: return (opts or {}).get('mirror_tls_credentials') != 'no' +def _mirror_external_ceph_clusters( + opts: Optional[Dict[str, str]] = None +) -> bool: + return (opts or {}).get('mirror_external_ceph_clusters') != 'no' + + def mgr_sqlite3_db( mgr: Any, opts: Optional[Dict[str, str]] = None ) -> SqliteStore: @@ -587,6 +609,8 @@ def mgr_sqlite3_db_with_mirroring( mirrors.append(MirrorUsersAndGroups(mirror_store)) if _mirror_tls_credentials(opts): mirrors.append(MirrorTLSCredentials(mirror_store)) + if _mirror_external_ceph_clusters(opts): + mirrors.append(MirrorExternalCephCluster(mirror_store)) return SqliteMirroringStore(mgr, tables, mirrors)