]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/PGMap: fix unable to shut up pg-not-scrubbed[deep-scrubbed] warn
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 20 Jul 2017 02:59:40 +0000 (10:59 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Fri, 21 Jul 2017 00:00:31 +0000 (08:00 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/mon/PGMap.cc

index a01a11c4fc72968a63f28d95739f62682e9ee9c3..faaa7a41ac5286a0c4acf1702dd889f36a856a5f 100644 (file)
@@ -3180,40 +3180,45 @@ void PGMap::get_health_checks(
   // PG_NOT_SCRUBBED
   // PG_NOT_DEEP_SCRUBBED
   {
-    list<string> detail, deep_detail;
-    const double age = cct->_conf->mon_warn_not_scrubbed +
-      cct->_conf->mon_scrub_interval;
-    utime_t cutoff = now;
-    cutoff -= age;
-    const double deep_age = cct->_conf->mon_warn_not_deep_scrubbed +
-      cct->_conf->osd_deep_scrub_interval;
-    utime_t deep_cutoff = now;
-    deep_cutoff -= deep_age;
-    for (auto& p : pg_stat) {
-      if (p.second.last_scrub_stamp < cutoff) {
-       ostringstream ss;
-       ss << "pg " << p.first << " not scrubbed since "
-          << p.second.last_scrub_stamp;
-        detail.push_back(ss.str());
+    if (cct->_conf->mon_warn_not_scrubbed ||
+        cct->_conf->mon_warn_not_deep_scrubbed) {
+      list<string> detail, deep_detail;
+      const double age = cct->_conf->mon_warn_not_scrubbed +
+        cct->_conf->mon_scrub_interval;
+      utime_t cutoff = now;
+      cutoff -= age;
+      const double deep_age = cct->_conf->mon_warn_not_deep_scrubbed +
+        cct->_conf->osd_deep_scrub_interval;
+      utime_t deep_cutoff = now;
+      deep_cutoff -= deep_age;
+      for (auto& p : pg_stat) {
+        if (cct->_conf->mon_warn_not_scrubbed &&
+            p.second.last_scrub_stamp < cutoff) {
+         ostringstream ss;
+         ss << "pg " << p.first << " not scrubbed since "
+            << p.second.last_scrub_stamp;
+          detail.push_back(ss.str());
+        }
+        if (cct->_conf->mon_warn_not_deep_scrubbed &&
+            p.second.last_deep_scrub_stamp < deep_cutoff) {
+         ostringstream ss;
+         ss << "pg " << p.first << " not deep-scrubbed since "
+            << p.second.last_deep_scrub_stamp;
+          deep_detail.push_back(ss.str());
+        }
       }
-      if (p.second.last_deep_scrub_stamp < deep_cutoff) {
-       ostringstream ss;
-       ss << "pg " << p.first << " not deep-scrubbed since "
-          << p.second.last_deep_scrub_stamp;
-        deep_detail.push_back(ss.str());
+      if (!detail.empty()) {
+        ostringstream ss;
+        ss << detail.size() << " pgs not scrubbed for " << age;
+        auto& d = checks->add("PG_NOT_SCRUBBED", HEALTH_WARN, ss.str());
+        d.detail.swap(detail);
+      }
+      if (!deep_detail.empty()) {
+        ostringstream ss;
+        ss << deep_detail.size() << " pgs not deep-scrubbed for " << deep_age;
+        auto& d = checks->add("PG_NOT_DEEP_SCRUBBED", HEALTH_WARN, ss.str());
+        d.detail.swap(deep_detail);
       }
-    }
-    if (!detail.empty()) {
-      ostringstream ss;
-      ss << detail.size() << " pgs not scrubbed for " << age;
-      auto& d = checks->add("PG_NOT_SCRUBBED", HEALTH_WARN, ss.str());
-      d.detail.swap(detail);
-    }
-    if (!deep_detail.empty()) {
-      ostringstream ss;
-      ss << deep_detail.size() << " pgs not deep-scrubbed for " << deep_age;
-      auto& d = checks->add("PG_NOT_DEEP_SCRUBBED", HEALTH_WARN, ss.str());
-      d.detail.swap(deep_detail);
     }
   }
 }