]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/mgr_util: CephFSClient - add helper methods
authorJan Fajerski <jfajerski@suse.com>
Wed, 6 May 2020 13:20:56 +0000 (15:20 +0200)
committerJan Fajerski <jfajerski@suse.com>
Thu, 27 Aug 2020 13:55:45 +0000 (15:55 +0200)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
src/pybind/mgr/mgr_util.py

index ffb0f54c4a1822a0fe34af6b78ce7e56a606afc9..4a2e1f22555bdb46cb313b28f27d262959836794 100644 (file)
@@ -247,6 +247,25 @@ class CephfsClient(object):
         # second, delete all libcephfs handles from connection pool
         self.connection_pool.del_all_handles()
 
+    def get_fs(self, fs_name):
+        fs_map = self.mgr.get('fs_map')
+        for fs in fs_map['filesystems']:
+            if fs['mdsmap']['fs_name'] == fs_name:
+                return fs
+        return None
+
+    def get_mds_names(self, fs_name):
+        fs = self.get_fs(fs_name)
+        if fs is None:
+            return []
+        return [mds['name'] for mds in fs['mdsmap']['info'].values()]
+
+    def get_metadata_pool(self, fs_name):
+        fs = self.get_fs(fs_name)
+        if fs:
+            return fs['mdsmap']['metadata_pool']
+        return None
+
 
 @contextlib.contextmanager
 def open_filesystem(fsc, fs_name):