]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon,cephfs: check MDS ID before aborting "mds fail" command
authorRishabh Dave <ridave@redhat.com>
Tue, 28 Jan 2025 17:43:31 +0000 (23:13 +0530)
committerRishabh Dave <ridave@redhat.com>
Tue, 28 Jan 2025 17:43:31 +0000 (23:13 +0530)
Fixes: https://tracker.ceph.com/issues/69694
Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/mon/MDSMonitor.cc
src/mon/MDSMonitor.h

index f742303c6e91eb3007500fa730f02ef77d1ee742..ba621bc6fb50f524791662ef9a222b6302aed9b1 100644 (file)
@@ -1548,9 +1548,15 @@ out:
   }
 }
 
-bool MDSMonitor::has_health_warnings(vector<mds_metric_t> warnings)
+bool MDSMonitor::has_health_warnings(vector<mds_metric_t> warnings, mds_gid_t gid)
 {
-  for (auto& [gid, health] : pending_daemon_health) {
+  for (auto& [_gid, health] : pending_daemon_health) {
+    if (gid != MDS_GID_NONE) {
+      if (gid != mds_gid_t(_gid)) {
+       continue;
+      }
+    }
+
     for (auto& metric : health.metrics) {
       // metric.type here is the type of health warning. We are only
       // looking for types of health warnings passed to this func member
@@ -1631,7 +1637,7 @@ int MDSMonitor::filesystem_command(
     }
 
     if (!confirm &&
-        has_health_warnings({MDS_HEALTH_TRIM, MDS_HEALTH_CACHE_OVERSIZED})) {
+        has_health_warnings({MDS_HEALTH_TRIM, MDS_HEALTH_CACHE_OVERSIZED}, gid)) {
       ss << errmsg_for_unhealthy_mds;
       return -EPERM;
     }
index dd2a269009de2ad07f58f45f253741eda50cc1b0..2f667abef8e49a94934463e5b43ee5818fcfd14f 100644 (file)
@@ -52,7 +52,8 @@ class MDSMonitor : public PaxosService, public PaxosFSMap, protected CommandHand
   bool preprocess_query(MonOpRequestRef op) override;  // true if processed.
   bool prepare_update(MonOpRequestRef op) override;
   bool should_propose(double& delay) override;
-  bool has_health_warnings(std::vector<mds_metric_t> warnings);
+  bool has_health_warnings(std::vector<mds_metric_t> warnings,
+                          mds_gid_t gid=MDS_GID_NONE);
   bool has_any_health_warning();
 
   bool should_print_status() const {