From: Rishabh Dave Date: Wed, 13 Mar 2024 09:31:02 +0000 (+0530) Subject: cephfs,mon: require confirmation to fail unhealthy FS X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f7a025e61dfbb19c36aa9041e4a11e46f486acd;p=ceph.git cephfs,mon: require confirmation to fail unhealthy FS Confirmation flag must be passed when running the command "ceph fs fail" when the MDS for this FS has either of the two health warnings: MDS_TRIM or MDS_CACHE_OVERSIZED. Else, the command will fail and print an appropriate error message. Restarting an MDS with these health warnings is not recommened since it will have a slow recovery during restart which will create new problems. Fixes: https://tracker.ceph.com/issues/61866 Signed-off-by: Rishabh Dave (cherry picked from commit b901616494a8359e59f7ec2cd661077c4aced01c) Conflicts: - src/mon/FSCommands.cc Lines around the patch are different in quincy compared to main branch. "get_mds_map()" is not available in quincy branch, unlike main. --- diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index 13477824002..853ae0f142b 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -114,6 +114,15 @@ class FailHandler : public FileSystemCommandHandler auto fs = fsmap.get_filesystem(fs_name); + bool confirm = false; + cmd_getval(cmdmap, "yes_i_really_mean_it", confirm); + if (!confirm && + mon->mdsmon()->has_health_warnings({ + MDS_HEALTH_TRIM, MDS_HEALTH_CACHE_OVERSIZED})) { + ss << errmsg_for_unhealthy_mds; + return -EPERM; + } + auto f = [](auto fs) { fs->mds_map.set_flag(CEPH_MDSMAP_NOT_JOINABLE); }; diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 8d09cd6a72f..87498197a1e 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -354,7 +354,8 @@ COMMAND("fs new " "make new filesystem using named pools and ", "fs", "rw") COMMAND("fs fail " - "name=fs_name,type=CephString ", + "name=fs_name,type=CephString " + "name=yes_i_really_mean_it,type=CephBool,req=false", "bring the file system down and all of its ranks", "fs", "rw") COMMAND("fs rm "