From: Sage Weil Date: Wed, 25 Sep 2019 13:12:59 +0000 (-0500) Subject: osd/OSDMap: remove remaining g_conf() usage X-Git-Tag: v15.1.0~1388^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ac746d343b698c88d1ce7a5f88db0672508755fa;p=ceph-ci.git osd/OSDMap: remove remaining g_conf() usage Use the explicitly-passed cct here instead of relying on the global symbol. The only user was check_health(), so this is easy. Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index be6894bd003..69de7f29a9c 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2014,7 +2014,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) // health health_check_map_t next; - tmp.check_health(g_ceph_context, &next); + tmp.check_health(cct, &next); encode_health(next, t); } diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 36444b172f5..b42e8b1c1eb 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -26,7 +26,6 @@ #include "common/errno.h" #include "common/Formatter.h" #include "common/TextTable.h" -#include "global/global_context.h" #include "include/ceph_features.h" #include "include/str_map.h" @@ -5518,7 +5517,7 @@ void OSDMap::check_health(CephContext *cct, break; type = crush->get_bucket_type(parent_id); if (!subtree_type_is_down( - g_ceph_context, parent_id, type, + cct, parent_id, type, &down_in_osds, &up_in_osds, &subtree_up, &subtree_type_down)) break; current = parent_id; @@ -5650,7 +5649,7 @@ void OSDMap::check_health(CephContext *cct, { // An osd could configure failsafe ratio, to something different // but for now assume it is the same here. - float fsr = g_conf()->osd_failsafe_full_ratio; + float fsr = cct->_conf->osd_failsafe_full_ratio; if (fsr > 1.0) fsr /= 100; float fr = get_full_ratio(); float br = get_backfillfull_ratio(); @@ -5803,19 +5802,19 @@ void OSDMap::check_health(CephContext *cct, } // OLD_CRUSH_TUNABLES - if (g_conf()->mon_warn_on_legacy_crush_tunables) { + if (cct->_conf->mon_warn_on_legacy_crush_tunables) { string min = crush->get_min_required_version(); - if (min < g_conf()->mon_crush_min_required_version) { + if (min < cct->_conf->mon_crush_min_required_version) { ostringstream ss; ss << "crush map has legacy tunables (require " << min - << ", min is " << g_conf()->mon_crush_min_required_version << ")"; + << ", min is " << cct->_conf->mon_crush_min_required_version << ")"; auto& d = checks->add("OLD_CRUSH_TUNABLES", HEALTH_WARN, ss.str(), 0); d.detail.push_back("see http://docs.ceph.com/docs/master/rados/operations/crush-map/#tunables"); } } // OLD_CRUSH_STRAW_CALC_VERSION - if (g_conf()->mon_warn_on_crush_straw_calc_version_zero) { + if (cct->_conf->mon_warn_on_crush_straw_calc_version_zero) { if (crush->get_straw_calc_version() == 0) { ostringstream ss; ss << "crush map has straw_calc_version=0"; @@ -5826,7 +5825,7 @@ void OSDMap::check_health(CephContext *cct, } // CACHE_POOL_NO_HIT_SET - if (g_conf()->mon_warn_on_cache_pools_without_hit_sets) { + if (cct->_conf->mon_warn_on_cache_pools_without_hit_sets) { list detail; for (auto p = pools.cbegin(); p != pools.cend(); ++p) { const pg_pool_t& info = p->second; diff --git a/src/tools/osdmaptool.cc b/src/tools/osdmaptool.cc index eed36e4e6a3..1190dc2bc28 100644 --- a/src/tools/osdmaptool.cc +++ b/src/tools/osdmaptool.cc @@ -659,7 +659,7 @@ int main(int argc, const char **argv) if (health) { health_check_map_t checks; - osdmap.check_health(g_ceph_context, &checks); + osdmap.check_health(cct.get(), &checks); JSONFormatter jf(true); jf.dump_object("checks", checks); jf.flush(cout);