]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add inject config for synthetic health message
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 21 Jul 2022 19:46:58 +0000 (15:46 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 19 Aug 2022 14:12:06 +0000 (10:12 -0400)
This will be used to force the MDSMonitor to process a beacon in
MDSMonitor::prepare_beacon.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 3ecb987dde4f82450fb269110dea7f30ae2c2748)

Conflicts:
src/common/options/mds.yaml.in

src/common/options.cc
src/mds/Beacon.cc
src/messages/MMDSBeacon.h
src/mon/MDSMonitor.cc

index ee7fe4830a78a37600cf54de44dc78d951c69879..55e1812cbbc802be5865fa77570503733eb9a7eb 100644 (file)
@@ -8727,6 +8727,10 @@ std::vector<Option> get_mds_options() {
     .set_default(0)
     .set_description(""),
 
+    Option("mds_inject_health_dummy", Option::TYPE_BOOL, Option::LEVEL_DEV)
+    .set_default(false)
+    .set_description(""),
+
     Option("mds_inject_traceless_reply_probability", Option::TYPE_FLOAT, Option::LEVEL_DEV)
     .set_default(0)
     .set_description(""),
index 6548970ec87d5b25ce2f74ee2ff79fd4894310e4..36ed489a3150950cd3cefef58b649dc15e50b425 100644 (file)
@@ -14,6 +14,7 @@
 
 
 #include "common/dout.h"
+#include "common/likely.h"
 #include "common/HeartbeatMap.h"
 
 #include "include/stringify.h"
@@ -295,6 +296,11 @@ void Beacon::notify_health(MDSRank const *mds)
 
   health.metrics.clear();
 
+  if (unlikely(g_conf().get_val<bool>("mds_inject_health_dummy"))) {
+    MDSHealthMetric m(MDS_HEALTH_DUMMY, HEALTH_ERR, std::string("dummy"));
+    health.metrics.push_back(m);
+  }
+
   // Detect presence of entries in DamageTable
   if (!mds->damage_table.empty()) {
     MDSHealthMetric m(MDS_HEALTH_DAMAGE, HEALTH_ERR, std::string(
index 068cc02e1037f0e38bff9cc9d3a43f733493813c..bd46926e485a1738419dfebdb664e00e0c1b4b2d 100644 (file)
@@ -45,6 +45,7 @@ enum mds_metric_t {
   MDS_HEALTH_SLOW_REQUEST,
   MDS_HEALTH_CACHE_OVERSIZED,
   MDS_HEALTH_SLOW_METADATA_IO,
+  MDS_HEALTH_DUMMY, // not a real health warning, for testing
 };
 
 inline const char *mds_metric_name(mds_metric_t m)
@@ -62,6 +63,7 @@ inline const char *mds_metric_name(mds_metric_t m)
   case MDS_HEALTH_SLOW_REQUEST: return "MDS_SLOW_REQUEST";
   case MDS_HEALTH_CACHE_OVERSIZED: return "MDS_CACHE_OVERSIZED";
   case MDS_HEALTH_SLOW_METADATA_IO: return "MDS_SLOW_METADATA_IO";
+  case MDS_HEALTH_DUMMY: return "MDS_DUMMY";
   default:
     return "???";
   }
index 011b8a81ab3fa91545291b7abed2975b2d1d1b40..00d5983faabb6f76175a211364ab523adc5db350 100644 (file)
@@ -248,6 +248,9 @@ void MDSMonitor::encode_pending(MonitorDBStore::TransactionRef t)
       health.decode(bl_i);
     }
     for (const auto &metric : health.metrics) {
+      if (metric.type == MDS_HEALTH_DUMMY) {
+        continue;
+      }
       const auto rank = info.rank;
       health_check_t *check = &new_checks.get_or_add(
        mds_metric_name(metric.type),
@@ -593,10 +596,16 @@ bool MDSMonitor::prepare_beacon(MonOpRequestRef op)
 
   std::set<mds_metric_t> new_types;
   for (const auto &i : new_health) {
+    if (i.type == MDS_HEALTH_DUMMY) {
+      continue;
+    }
     new_types.insert(i.type);
   }
 
   for (const auto &new_metric: new_health) {
+    if (new_metric.type == MDS_HEALTH_DUMMY) {
+      continue;
+    }
     if (old_types.count(new_metric.type) == 0) {
       dout(10) << "MDS health message (" << m->get_orig_source()
               << "): " << new_metric.sev << " " << new_metric.message << dendl;