From 6e1d7c4b3936c1c5d3a97529d5b881af275dcab1 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 15 Jan 2019 14:10:09 -0800 Subject: [PATCH] qa: use simpler fs fail to bring fs down Signed-off-by: Patrick Donnelly --- qa/tasks/cephfs/filesystem.py | 20 ++++++++++---------- src/mon/FSCommands.cc | 4 +++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index cac566a252fdc..f01844c041267 100644 --- a/qa/tasks/cephfs/filesystem.py +++ b/qa/tasks/cephfs/filesystem.py @@ -283,12 +283,6 @@ class MDSCluster(CephCluster): def status(self): return FSStatus(self.mon_manager) - def set_down(self, down=True): - self.mon_manager.raw_cluster_cmd("fs", "set", str(self.name), "down", str(down).lower()) - - def set_joinable(self, joinable=True): - self.mon_manager.raw_cluster_cmd("fs", "set", str(self.name), "joinable", str(joinable).lower()) - def delete_all_filesystems(self): """ Remove all filesystems that exist, and any pools in use by them. @@ -301,7 +295,7 @@ class MDSCluster(CephCluster): # mark cluster down for each fs to prevent churn during deletion status = self.status() for fs in status.get_filesystems(): - self.mon_manager.raw_cluster_cmd("fs", "set", str(fs['mdsmap']['fs_name']), "joinable", "false") + self.mon_manager.raw_cluster_cmd("fs", "fail", str(fs['mdsmap']['fs_name'])) # get a new copy as actives may have since changed status = self.status() @@ -309,9 +303,6 @@ class MDSCluster(CephCluster): mdsmap = fs['mdsmap'] metadata_pool = pool_id_name[mdsmap['metadata_pool']] - for gid in mdsmap['up'].values(): - self.mon_manager.raw_cluster_cmd('mds', 'fail', gid.__str__()) - self.mon_manager.raw_cluster_cmd('fs', 'rm', mdsmap['fs_name'], '--yes-i-really-mean-it') self.mon_manager.raw_cluster_cmd('osd', 'pool', 'delete', metadata_pool, metadata_pool, @@ -477,10 +468,19 @@ class Filesystem(MDSCluster): assert(mds_map['max_mds'] == max_mds) assert(mds_map['in'] == list(range(0, max_mds))) + def fail(self): + self.mon_manager.raw_cluster_cmd("fs", "fail", str(self.name)) + def set_var(self, var, *args): a = map(str, args) self.mon_manager.raw_cluster_cmd("fs", "set", self.name, var, *a) + def set_down(self, down=True): + self.set_var("down", str(down).lower()) + + def set_joinable(self, joinable=True): + self.set_var("joinable", str(joinable).lower()) + def set_max_mds(self, max_mds): self.set_var("max_mds", "%d" % max_mds) diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index a840e815894fb..4e27cf74b493e 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -122,7 +122,9 @@ class FailHandler : public FileSystemCommandHandler for (const auto& gid : to_fail) { mon->mdsmon()->fail_mds_gid(fsmap, gid); } - mon->osdmon()->propose_pending(); + if (!to_fail.empty()) { + mon->osdmon()->propose_pending(); + } ss << fs_name; ss << " marked not joinable; MDS cannot join the cluster. All MDS ranks marked failed."; -- 2.39.5