]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon,cephfs: require confirmation when changing max_mds on unhealthy cluster
authorRishabh Dave <ridave@redhat.com>
Fri, 23 Aug 2024 12:49:43 +0000 (18:19 +0530)
committerRishabh Dave <ridave@redhat.com>
Tue, 1 Oct 2024 07:15:28 +0000 (12:45 +0530)
User must pass the confirmation flag (--yes-i-really-mean-it) to change
the value of CephFS setting variable "max_mds" when the Ceph cluster is
unhealthy.

This measure was decided upon to prevent users from changing "max_mds"
as a measure of troubleshotoing unhealthy cluster.

Fixes: https://tracker.ceph.com/issues/66301
Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/mon/FSCommands.cc
src/mon/MDSMonitor.cc
src/mon/MDSMonitor.h

index 62d37574ded670273c1f7448b0204ffef061a954..b935ace4affba04254a22fa8850bee090d49474a 100644 (file)
@@ -385,6 +385,17 @@ public:
       return -EINVAL;
     }
 
+  bool confirm = false;
+  cmd_getval(cmdmap, "yes_i_really_mean_it", confirm);
+  if (var == "max_mds" && !confirm && mon->mdsmon()->has_any_health_warning()) {
+    ss << "One or more file system health warnings are present. Modifying "
+       << "the file system setting variable \"max_mds\" may not help "
+       << "troubleshoot or recover from these warnings and may further "
+       << "destabilize the system. If you really wish to proceed, run "
+       << "again with --yes-i-really-mean-it";
+    return -EPERM;
+  }
+
     return set_val(mon, fsmap, op, cmdmap, ss, fsp->get_fscid(), var, val);
   }
 };
index 76a57ac443de76ac29d3b49db544f9c36efe3bda..d8cca4ceb61b1f208c820b10cc9ee4593fc48bde 100644 (file)
@@ -1557,6 +1557,13 @@ bool MDSMonitor::has_health_warnings(vector<mds_metric_t> warnings)
   return false;
 }
 
+bool MDSMonitor::has_any_health_warning()
+{
+  return std::any_of(
+    pending_daemon_health.begin(), pending_daemon_health.end(),
+    [](auto& it) { return !it.second.metrics.empty() ? true : false; });
+}
+
 int MDSMonitor::filesystem_command(
     FSMap &fsmap,
     MonOpRequestRef op,
index b0f88cd31302d779dace82506cc3c2edc1b46730..dd2a269009de2ad07f58f45f253741eda50cc1b0 100644 (file)
@@ -53,6 +53,7 @@ class MDSMonitor : public PaxosService, public PaxosFSMap, protected CommandHand
   bool prepare_update(MonOpRequestRef op) override;
   bool should_propose(double& delay) override;
   bool has_health_warnings(std::vector<mds_metric_t> warnings);
+  bool has_any_health_warning();
 
   bool should_print_status() const {
     auto& fs = get_fsmap();