]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/smb: add external ceph cluster to sqlite store
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 3 Dec 2025 19:35:10 +0000 (14:35 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 17 Feb 2026 15:59:12 +0000 (10:59 -0500)
Starting to get silly with the boilerplate but it should do the trick.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/smb/sqlite_store.py

index d68fd2da28a47f714ea8f7dd488e02e35c3214df..0f01aa5f5b005db3438fa8d7e2433403ff8c2fa9 100644 (file)
@@ -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)