From: Jan Fajerski Date: Wed, 6 May 2020 13:20:56 +0000 (+0200) Subject: pybind/mgr/mgr_util: CephFSClient - add helper methods X-Git-Tag: v16.1.0~1299^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2ec5a2387e1a9d4cde58b0ad8f79ff40771b87ca;p=ceph.git pybind/mgr/mgr_util: CephFSClient - add helper methods Signed-off-by: Jan Fajerski --- diff --git a/src/pybind/mgr/mgr_util.py b/src/pybind/mgr/mgr_util.py index ffb0f54c4a18..4a2e1f22555b 100644 --- a/src/pybind/mgr/mgr_util.py +++ b/src/pybind/mgr/mgr_util.py @@ -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):