]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/OSDMap: remove remaining g_conf() usage
authorSage Weil <sage@redhat.com>
Wed, 25 Sep 2019 13:12:59 +0000 (08:12 -0500)
committerSage Weil <sage@redhat.com>
Wed, 25 Sep 2019 14:44:45 +0000 (09:44 -0500)
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 <sage@redhat.com>
src/mon/OSDMonitor.cc
src/osd/OSDMap.cc
src/tools/osdmaptool.cc

index be6894bd003260b54be8c6353ae7c335927cc8d0..69de7f29a9cf0b14eae0034539b5e80e235abd4d 100644 (file)
@@ -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);
 }
 
index 36444b172f53f2c641f74821bd1671f25e78fdc4..b42e8b1c1ebfce939d43308cabfd1e5ba4e4062f 100644 (file)
@@ -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<string> detail;
     for (auto p = pools.cbegin(); p != pools.cend(); ++p) {
       const pg_pool_t& info = p->second;
index eed36e4e6a3517a5e68285c0f41af793d3b463fb..1190dc2bc2816f2f2dd882eecf9bdc7ab962269a 100644 (file)
@@ -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);