From 2ec5a2387e1a9d4cde58b0ad8f79ff40771b87ca Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Wed, 6 May 2020 15:20:56 +0200 Subject: [PATCH] pybind/mgr/mgr_util: CephFSClient - add helper methods Signed-off-by: Jan Fajerski --- src/pybind/mgr/mgr_util.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/pybind/mgr/mgr_util.py b/src/pybind/mgr/mgr_util.py index ffb0f54c4a1..4a2e1f22555 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): -- 2.47.3