From: xie xingguo Date: Sat, 22 Jul 2017 09:03:16 +0000 (+0800) Subject: osd/OSDMap: expose pool application warnings X-Git-Tag: v12.1.2~47^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5035d4c364ae38bd2b7d515428685934f0245b10;p=ceph.git osd/OSDMap: expose pool application warnings by moving the code into proper place. Signed-off-by: xie xingguo --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 1b5ce757c1be..7ed726f16a6d 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -3187,6 +3187,44 @@ void PGMap::get_health_checks( } } } + + // POOL_APP + { + list detail; + for (auto &it : pools) { + const pg_pool_t &pool = it.second; + const string& pool_name = osdmap.get_pool_name(it.first); + auto it2 = pg_pool_sum.find(it.first); + if (it2 == pg_pool_sum.end()) { + continue; + } + const pool_stat_t *pstat = &it2->second; + if (pstat == nullptr) { + continue; + } + const object_stat_sum_t& sum = pstat->stats.sum; + // application metadata is not encoded until luminous is minimum + // required release + if (osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS && + sum.num_objects > 0 && pool.application_metadata.empty() && + !pool.is_tier() && !g_conf->mon_debug_no_require_luminous) { + stringstream ss; + ss << "application not enabled on pool '" << pool_name << "'"; + detail.push_back(ss.str()); + } + } + if (!detail.empty()) { + ostringstream ss; + ss << "application not enabled on " << detail.size() << " pool(s)"; + auto& d = checks->add("POOL_APP_NOT_ENABLED", HEALTH_WARN, ss.str()); + stringstream tip; + tip << "use 'ceph osd pool application enable " + << "', where is 'cephfs', 'rbd', 'rgw', " + << "or freeform for custom applications."; + detail.push_back(tip.str()); + d.detail.swap(detail); + } + } } void PGMap::get_health(