]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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)
committerNathan Cutler <ncutler@suse.com>
Fri, 24 Jan 2020 12:38:49 +0000 (13:38 +0100)
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>
(cherry picked from commit ac746d343b698c88d1ce7a5f88db0672508755fa)

Conflicts:
src/osd/OSDMap.cc
- checks->add() takes an extra argument in master, but this is unrelated to this
  change

src/mon/OSDMonitor.cc
src/osd/OSDMap.cc
src/tools/osdmaptool.cc

index 972a47a8f220cc8e17277d241c3cab19df1f761d..64907018b3e176e690417b9c7636620bef0b6be8 100644 (file)
@@ -1870,7 +1870,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 889131210f753201de542b1372829081f993d442..b31fe6697407148a36b7904c3ad5c255435563ff 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"
 
@@ -5459,7 +5458,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;
@@ -5588,7 +5587,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();
@@ -5739,19 +5738,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());
       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";
@@ -5762,7 +5761,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 (map<int64_t, pg_pool_t>::const_iterator p = pools.begin();
         p != pools.end();
index 9d62f00db7dbd5cc146bf201a51bd82e50190934..fbbcddafc6a9a4dbb01605175bd670f09942b4de 100644 (file)
@@ -739,7 +739,7 @@ skip_upmap:
 
   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);