]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: replace all require_*_osds flag checks with a require_osd_release comparison
authorSage Weil <sage@redhat.com>
Fri, 12 May 2017 15:43:16 +0000 (11:43 -0400)
committerSage Weil <sage@redhat.com>
Tue, 30 May 2017 01:34:29 +0000 (21:34 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MgrMonitor.cc
src/mon/Monitor.cc
src/mon/OSDMonitor.cc
src/mon/PGMap.cc
src/mon/PGMonitor.cc
src/osd/ECBackend.cc
src/osd/OSD.cc
src/osd/OSDMap.cc
src/osd/PrimaryLogPG.cc
src/osd/ReplicatedBackend.cc
src/osd/osd_types.cc

index 194a65c383ea3ea19dbbcb6c77a91dc257fff166..fb9fa7ca9772cf57d48085ab3435a12e44a7c519 100644 (file)
@@ -341,7 +341,7 @@ void MgrMonitor::get_health(
   if (!map.available) {
     auto level = HEALTH_WARN;
     // do not escalate to ERR if they are still upgrading to jewel.
-    if (mon->osdmon()->osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+    if (mon->osdmon()->osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS) {
       utime_t now = ceph_clock_now();
       if (first_seen_inactive != utime_t() &&
          now - first_seen_inactive > g_conf->mon_mgr_inactive_grace) {
index 2a1e6ad111e1a7f8a2817679349925d1a266c77d..bc8f4fb79fcb17461deba3dd8326afe9262f1cf9 100644 (file)
@@ -2792,7 +2792,7 @@ void Monitor::handle_command(MonOpRequestRef op)
     Formatter *f = Formatter::create("json");
     // hide mgr commands until luminous upgrade is complete
     bool hide_mgr_flag =
-      !osdmon()->osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS);
+      osdmon()->osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS;
     format_command_descriptions(leader_supported_mon_commands,
                                leader_supported_mon_commands_size, f, &rdata,
                                hide_mgr_flag);
@@ -2907,7 +2907,7 @@ void Monitor::handle_command(MonOpRequestRef op)
     << "cmd=" << m->cmd << ": dispatch";
 
   if (mon_cmd->is_mgr() &&
-      osdmon()->osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+      osdmon()->osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS) {
     const auto& hdr = m->get_header();
     uint64_t size = hdr.front_len + hdr.middle_len + hdr.data_len;
     uint64_t max =
index 0d3b3b7dd08a22272d57ddfa976fcbd4bf09bb51..55d459b3fac1939d5ed3e335505f1f52bea982d9 100644 (file)
@@ -885,7 +885,7 @@ void OSDMonitor::create_pending()
     dout(1) << __func__ << " setting backfillfull_ratio = "
            << pending_inc.new_backfillfull_ratio << dendl;
   }
-  if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+  if (osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
     // transition full ratios from PGMap to OSDMap (on upgrade)
     PGMap *pg_map = &mon->pgmon()->pg_map;
     if (osdmap.full_ratio != pg_map->full_ratio) {
@@ -1160,7 +1160,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
     tmp.deepish_copy_from(osdmap);
     tmp.apply_incremental(pending_inc);
 
-    if (tmp.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+    if (tmp.require_osd_release >= CEPH_RELEASE_LUMINOUS) {
       // set or clear full/nearfull?
       int full, backfill, nearfull;
       tmp.count_full_nearfull_osds(&full, &backfill, &nearfull);
@@ -1238,21 +1238,21 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
     tmp.apply_incremental(pending_inc);
 
     // determine appropriate features
-    if (!tmp.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+    if (tmp.require_osd_release < CEPH_RELEASE_LUMINOUS) {
       dout(10) << __func__ << " encoding without feature SERVER_LUMINOUS"
               << dendl;
       features &= ~CEPH_FEATURE_SERVER_LUMINOUS;
     }
-    if (!tmp.test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
-      dout(10) << __func__ << " encoding without feature SERVER_JEWEL" << dendl;
-      features &= ~CEPH_FEATURE_SERVER_JEWEL;
-    }
-    if (!tmp.test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
+    if (tmp.require_osd_release < CEPH_RELEASE_KRAKEN) {
       dout(10) << __func__ << " encoding without feature SERVER_KRAKEN | "
               << "MSG_ADDR2" << dendl;
       features &= ~(CEPH_FEATURE_SERVER_KRAKEN |
                    CEPH_FEATURE_MSG_ADDR2);
     }
+    if (tmp.require_osd_release < CEPH_RELEASE_JEWEL) {
+      dout(10) << __func__ << " encoding without feature SERVER_JEWEL" << dendl;
+      features &= ~CEPH_FEATURE_SERVER_JEWEL;
+    }
     dout(10) << __func__ << " encoding full map with " << features << dendl;
 
     bufferlist fullbl;
@@ -1292,7 +1292,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
   if (mon->monmap->get_required_features().contains_all(
        ceph::features::mon::FEATURE_LUMINOUS)) {
     auto pending_creatings = update_pending_pgs(pending_inc);
-    if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+    if (osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
       dout(7) << __func__ << " in the middle of upgrading, "
              << " trimming pending creating_pgs using pgmap" << dendl;
       trim_creating_pgs(&pending_creatings, mon->pgmon()->pg_map);
@@ -2158,7 +2158,7 @@ bool OSDMonitor::preprocess_boot(MonOpRequestRef op)
     goto ignore;
   }
 
-  if (osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS) &&
+  if (osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS &&
       !HAVE_FEATURE(m->osd_features, SERVER_LUMINOUS)) {
     mon->clog->info() << "disallowing boot of OSD "
                      << m->get_orig_source_inst()
@@ -2168,7 +2168,7 @@ bool OSDMonitor::preprocess_boot(MonOpRequestRef op)
     goto ignore;
   }
 
-  if (osdmap.test_flag(CEPH_OSDMAP_REQUIRE_JEWEL) &&
+  if (osdmap.require_osd_release >= CEPH_RELEASE_JEWEL &&
       !(m->osd_features & CEPH_FEATURE_SERVER_JEWEL)) {
     mon->clog->info() << "disallowing boot of OSD "
                      << m->get_orig_source_inst()
@@ -2178,7 +2178,7 @@ bool OSDMonitor::preprocess_boot(MonOpRequestRef op)
     goto ignore;
   }
 
-  if (osdmap.test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN) &&
+  if (osdmap.require_osd_release >= CEPH_RELEASE_KRAKEN &&
       !HAVE_FEATURE(m->osd_features, SERVER_KRAKEN)) {
     mon->clog->info() << "disallowing boot of OSD "
                      << m->get_orig_source_inst()
@@ -2212,19 +2212,19 @@ bool OSDMonitor::preprocess_boot(MonOpRequestRef op)
 
   // make sure upgrades stop at luminous
   if (HAVE_FEATURE(m->osd_features, SERVER_M) &&
-      !osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+      osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
     mon->clog->info() << "disallowing boot of post-luminous OSD "
                      << m->get_orig_source_inst()
-                     << " because require_luminous_osds is not set";
+                     << " because require_osd_release < luminous";
     goto ignore;
   }
 
   // make sure upgrades stop at jewel
   if (HAVE_FEATURE(m->osd_features, SERVER_KRAKEN) &&
-      !osdmap.test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
+      osdmap.require_osd_release < CEPH_RELEASE_JEWEL) {
     mon->clog->info() << "disallowing boot of post-jewel OSD "
                      << m->get_orig_source_inst()
-                     << " because require_jewel_osds is not set";
+                     << " because require_osd_release < jewel";
     goto ignore;
   }
 
@@ -3305,7 +3305,7 @@ void OSDMonitor::tick()
   bool do_propose = false;
   utime_t now = ceph_clock_now();
 
-  if (osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS) &&
+  if (osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS &&
       mon->monmap->get_required_features().contains_all(
        ceph::features::mon::FEATURE_LUMINOUS)) {
     if (handle_osd_timeouts(now, last_osd_report)) {
@@ -3408,7 +3408,7 @@ void OSDMonitor::tick()
   }
 
   // if map full setting has changed, get that info out there!
-  if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS) &&
+  if (osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS &&
       mon->pgmon()->is_readable()) {
     // for pre-luminous compat only!
     if (!mon->pgmon()->pg_map.full_osds.empty()) {
@@ -3632,7 +3632,7 @@ void OSDMonitor::get_health(list<pair<health_status_t,string> >& summary,
       }
     }
 
-    if (osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+    if (osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS) {
       // 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;
@@ -3827,25 +3827,25 @@ void OSDMonitor::get_health(list<pair<health_status_t,string> >& summary,
     if (g_conf->mon_debug_no_require_luminous) {
       // ignore these checks
     } else if (HAVE_FEATURE(osdmap.get_up_osd_features(), SERVER_LUMINOUS) &&
-       !osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
-      string msg = "all OSDs are running luminous or later but the"
-       " 'require_luminous_osds' osdmap flag is not set";
+              osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
+      string msg = "all OSDs are running luminous or later but"
+       " require_osd_release < luminous";
       summary.push_back(make_pair(HEALTH_WARN, msg));
       if (detail) {
        detail->push_back(make_pair(HEALTH_WARN, msg));
       }
     } else if (HAVE_FEATURE(osdmap.get_up_osd_features(), SERVER_KRAKEN) &&
-       !osdmap.test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
-      string msg = "all OSDs are running kraken or later but the"
-       " 'require_kraken_osds' osdmap flag is not set";
+              osdmap.require_osd_release < CEPH_RELEASE_KRAKEN) {
+      string msg = "all OSDs are running kraken or later but"
+       " require_osd_release < kraken";
       summary.push_back(make_pair(HEALTH_WARN, msg));
       if (detail) {
        detail->push_back(make_pair(HEALTH_WARN, msg));
       }
     } else if (HAVE_FEATURE(osdmap.get_up_osd_features(), SERVER_JEWEL) &&
-              !osdmap.test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
-      string msg = "all OSDs are running jewel or later but the"
-       " 'require_jewel_osds' osdmap flag is not set";
+              osdmap.require_osd_release < CEPH_RELEASE_JEWEL) {
+      string msg = "all OSDs are running jewel or later but"
+       " require_osd_release < jewel";
       summary.push_back(make_pair(HEALTH_WARN, msg));
       if (detail) {
        detail->push_back(make_pair(HEALTH_WARN, msg));
@@ -7423,9 +7423,9 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
   } else if (prefix == "osd set-full-ratio" ||
             prefix == "osd set-backfillfull-ratio" ||
              prefix == "osd set-nearfull-ratio") {
-    if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
-      ss << "you must complete the upgrade and set require_luminous_osds before"
-        << " using the new interface";
+    if (osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
+      ss << "you must complete the upgrade and set require_osd_release ="
+        << "luminous before using the new interface";
       err = -EPERM;
       goto reply;
     }
@@ -7448,9 +7448,9 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
                                              get_last_committed() + 1));
     return true;
   } else if (prefix == "osd set-require-min-compat-client") {
-    if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
-      ss << "you must complete the upgrade and set require_luminous_osds before"
-        << " using the new interface";
+    if (osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
+      ss << "you must complete the upgrade and set require_osd_release ="
+        << "luminous before using the new interface";
       err = -EPERM;
       goto reply;
     }
@@ -7804,8 +7804,9 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
     ss << "set " << pgid << " primary_temp mapping to " << osd;
     goto update;
   } else if (prefix == "osd pg-upmap") {
-    if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
-      ss << "you must set the require_luminous_osds flag to use this feature";
+    if (osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
+      ss << "you must complete the upgrade and set require_osd_release ="
+        << "luminous before using the new interface";
       err = -EPERM;
       goto reply;
     }
@@ -7866,8 +7867,9 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
     ss << "set " << pgid << " pg_upmap mapping to " << new_pg_upmap;
     goto update;
   } else if (prefix == "osd rm-pg-upmap") {
-    if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
-      ss << "you must set the require_luminous_osds flag to use this feature";
+    if (osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
+      ss << "you must complete the upgrade and set require_osd_release ="
+        << "luminous before using the new interface";
       err = -EPERM;
       goto reply;
     }
@@ -7906,8 +7908,9 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
     ss << "clear " << pgid << " pg_upmap mapping";
     goto update;
   } else if (prefix == "osd pg-upmap-items") {
-    if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
-      ss << "you must set the require_luminous_osds flag to use this feature";
+    if (osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
+      ss << "you must complete the upgrade and set require_osd_release ="
+        << "luminous before using the new interface";
       err = -EPERM;
       goto reply;
     }
@@ -7981,8 +7984,9 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
     ss << "set " << pgid << " pg_upmap_items mapping to " << new_pg_upmap_items;
     goto update;
   } else if (prefix == "osd rm-pg-upmap-items") {
-    if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
-      ss << "you must set the require_luminous_osds flag to use this feature";
+    if (osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
+      ss << "you must complete the upgrade and set require_osd_release ="
+        << "luminous before using the new interface";
       err = -EPERM;
       goto reply;
     }
index d420d9eea49f87a396133b118f0c7b862382a428..5b7243fc5f163725e95c1200c527274f7cf01644 100644 (file)
@@ -1905,7 +1905,8 @@ int64_t PGMap::get_rule_avail(const OSDMap& osdmap, int ruleno) const
   }
 
   float fratio;
-  if (osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS) && osdmap.get_full_ratio() > 0) {
+  if (osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS &&
+      osdmap.get_full_ratio() > 0) {
     fratio = osdmap.get_full_ratio();
   } else if (full_ratio > 0) {
     fratio = full_ratio;
index c764394d9d881c44cdca4785371e6970633f8bae..e492f57a3d5006f6e353b987e2863c902972232a 100644 (file)
@@ -1088,7 +1088,7 @@ bool PGMonitor::prepare_command(MonOpRequestRef op)
     goto update;
   } else if (prefix == "pg set_full_ratio" ||
              prefix == "pg set_nearfull_ratio") {
-    if (mon->osdmon()->osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+    if (mon->osdmon()->osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS) {
       ss << "please use the new luminous interfaces"
         << " ('osd set-full-ratio' and 'osd set-nearfull-ratio')";
       r = -EPERM;
@@ -1486,7 +1486,7 @@ void PGMonitor::get_health(list<pair<health_status_t,string> >& summary,
   }
 
   // full/nearfull
-  if (!mon->osdmon()->osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+  if (mon->osdmon()->osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
     check_full_osd_health(summary, detail, pg_map.full_osds, "full",
                          HEALTH_ERR);
     check_full_osd_health(summary, detail, pg_map.nearfull_osds, "near full",
index 53a8814b2c905cd467939e9cee19661ff66e1a69..c35bf1ae21c8d3ee61eafbe60750a9343ff60e33 100644 (file)
@@ -1898,7 +1898,7 @@ bool ECBackend::try_reads_to_commit()
       op->plan,
       ec_impl,
       get_parent()->get_info().pgid.pgid,
-      !get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN),
+      (get_osdmap()->require_osd_release < CEPH_RELEASE_KRAKEN),
       sinfo,
       op->remote_read_result,
       op->log_entries,
@@ -2030,7 +2030,7 @@ bool ECBackend::try_finish_rmw()
   if (op->version > committed_to)
     committed_to = op->version;
 
-  if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
+  if (get_osdmap()->require_osd_release >= CEPH_RELEASE_KRAKEN) {
     if (op->version > get_parent()->get_log().get_can_rollback_to() &&
        waiting_reads.empty() &&
        waiting_commit.empty()) {
index 75b7c0c5667f0ce6d26cabfd2d3df1f7cdbacdb7..df1b4bea9ae077a9953305d36bfe3b888a9dc815 100644 (file)
@@ -771,7 +771,7 @@ void OSDService::check_full_status(const osd_stat_t &osd_stat)
   float full_ratio = std::max(osdmap->get_full_ratio(), backfillfull_ratio);
   float failsafe_ratio = std::max(get_failsafe_full_ratio(), full_ratio);
 
-  if (!osdmap->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+  if (osdmap->require_osd_release < CEPH_RELEASE_LUMINOUS) {
     // use the failsafe for nearfull and full; the mon isn't using the
     // flags anyway because we're mid-upgrade.
     full_ratio = failsafe_ratio;
@@ -5541,7 +5541,7 @@ void OSD::_preboot(epoch_t oldest, epoch_t newest)
   } else if (!osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)) {
     derr << "osdmap SORTBITWISE OSDMap flag is NOT set; please set it"
         << dendl;
-  } else if (!osdmap->test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
+  } else if (osdmap->require_osd_release < CEPH_RELEASE_JEWEL) {
     derr << "osdmap REQUIRE_JEWEL OSDMap flag is NOT set; please set it"
         << dendl;
   } else if (!monc->monmap.get_required_features().contains_all(
index d80723c74c98dc80fed3df9358db0bc72b4ff23e..724b1737a2920ebb2ed727fbb49bbfcf0284f90c 100644 (file)
@@ -1289,14 +1289,14 @@ uint64_t OSDMap::get_features(int entity_type, uint64_t *pmask) const
 
   if (entity_type == CEPH_ENTITY_TYPE_OSD) {
     const uint64_t jewel_features = CEPH_FEATURE_SERVER_JEWEL;
-    if (test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
+    if (require_osd_release >= CEPH_RELEASE_JEWEL) {
       features |= jewel_features;
     }
     mask |= jewel_features;
 
     const uint64_t kraken_features = CEPH_FEATUREMASK_SERVER_KRAKEN
       | CEPH_FEATURE_MSG_ADDR2;
-    if (test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
+    if (require_osd_release >= CEPH_RELEASE_KRAKEN) {
       features |= kraken_features;
     }
     mask |= kraken_features;
index e6d57cd09e5e5c78186b431a30ab15c350501ed8..87616ae48a706e453a202501144109ddc216b114 100644 (file)
@@ -2175,7 +2175,7 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
     }
     dout(20) << __func__ << "find_object_context got error " << r << dendl;
     if (op->may_write() &&
-       get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
+       get_osdmap()->require_osd_release >= CEPH_RELEASE_KRAKEN) {
       record_write_error(op, oid, nullptr, r);
     } else {
       osd->reply_op_error(op, r);
@@ -2252,7 +2252,7 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
     dout(20) << __func__ << " returned an error: " << r << dendl;
     close_op_ctx(ctx);
     if (op->may_write() &&
-       get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
+       get_osdmap()->require_osd_release >= CEPH_RELEASE_KRAKEN) {
       record_write_error(op, oid, nullptr, r);
     } else {
       osd->reply_op_error(op, r);
@@ -3634,7 +3634,7 @@ PrimaryLogPG::OpContextUPtr PrimaryLogPG::trim_object(
   SnapSet& snapset = obc->ssc->snapset;
 
   bool legacy = snapset.is_legacy() ||
-    !get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS);
+    get_osdmap()->require_osd_release < CEPH_RELEASE_LUMINOUS;
 
   object_info_t &coi = obc->obs.oi;
   set<snapid_t> old_snaps;
@@ -5931,7 +5931,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
          result = -ENOENT;
          break;
        }
-       if (!get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+       if (get_osdmap()->require_osd_release < CEPH_RELEASE_LUMINOUS) {
          result = -EOPNOTSUPP;
          break;
        }
@@ -6633,7 +6633,7 @@ inline int PrimaryLogPG::_delete_oid(
     whiteout = true;
   }
   bool legacy;
-  if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+  if (get_osdmap()->require_osd_release >= CEPH_RELEASE_LUMINOUS) {
     legacy = false;
     // in luminous or later, we can't delete the head if there are
     // clones. we trust the caller passing no_whiteout has already
@@ -6974,7 +6974,7 @@ void PrimaryLogPG::make_writeable(OpContext *ctx)
     snap_oi->copy_user_bits(ctx->obs->oi);
 
     bool legacy = ctx->new_snapset.is_legacy() ||
-      !get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS);
+      get_osdmap()->require_osd_release < CEPH_RELEASE_LUMINOUS;
     if (legacy) {
       snap_oi->legacy_snaps = snaps;
     }
@@ -7035,7 +7035,7 @@ void PrimaryLogPG::make_writeable(OpContext *ctx)
   // update snapset with latest snap context
   ctx->new_snapset.seq = snapc.seq;
   ctx->new_snapset.snaps = snapc.snaps;
-  if (!get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+  if (get_osdmap()->require_osd_release < CEPH_RELEASE_LUMINOUS) {
     // pessimistic assumption that this is a net-new legacy SnapSet
     ctx->delta_stats.num_legacy_snapsets++;
     ctx->new_snapset.head_exists = ctx->new_obs.exists;
@@ -7223,7 +7223,7 @@ int PrimaryLogPG::prepare_transaction(OpContext *ctx)
   int result = do_osd_ops(ctx, ctx->ops);
   if (result < 0) {
     if (ctx->op->may_write() &&
-       get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
+       get_osdmap()->require_osd_release >= CEPH_RELEASE_KRAKEN) {
       // need to save the error code in the pg log, to detect dup ops,
       // but do nothing else
       ctx->update_log_only = true;
@@ -7235,7 +7235,7 @@ int PrimaryLogPG::prepare_transaction(OpContext *ctx)
   if (ctx->op_t->empty() && !ctx->modify) {
     unstable_stats.add(ctx->delta_stats);
     if (ctx->op->may_write() &&
-       get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
+       get_osdmap()->require_osd_release >= CEPH_RELEASE_KRAKEN) {
       ctx->update_log_only = true;
     }
     return result;
@@ -7314,7 +7314,7 @@ void PrimaryLogPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc
                        info.pgid.pool(), soid.get_namespace());
       dout(10) << " final snapset " << ctx->new_snapset
               << " in " << snapoid << dendl;
-      assert(!get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS));
+      assert(get_osdmap()->require_osd_release < CEPH_RELEASE_LUMINOUS);
       ctx->log.push_back(pg_log_entry_t(pg_log_entry_t::MODIFY, snapoid,
                                        ctx->at_version,
                                        eversion_t(),
@@ -7402,7 +7402,7 @@ void PrimaryLogPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc
   }
 
   bool legacy_snapset = ctx->new_snapset.is_legacy() ||
-    !get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS);
+    get_osdmap()->require_osd_release < CEPH_RELEASE_LUMINOUS;
 
   // append to log
   ctx->log.push_back(pg_log_entry_t(log_op_type, soid, ctx->at_version,
@@ -8314,7 +8314,7 @@ void PrimaryLogPG::finish_promote(int r, CopyResults *results,
   tctx->extra_reqids = results->reqids;
 
   bool legacy_snapset = tctx->new_snapset.is_legacy() ||
-    !get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS);
+    get_osdmap()->require_osd_release < CEPH_RELEASE_LUMINOUS;
 
   if (whiteout) {
     // create a whiteout
@@ -8367,7 +8367,7 @@ void PrimaryLogPG::finish_promote(int r, CopyResults *results,
     assert(tctx->new_obs.oi.soid.snap == CEPH_NOSNAP);
     tctx->new_snapset.from_snap_set(
       results->snapset,
-      !get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS));
+      get_osdmap()->require_osd_release < CEPH_RELEASE_LUMINOUS);
   }
   tctx->new_snapset.head_exists = true;
   dout(20) << __func__ << " new_snapset " << tctx->new_snapset << dendl;
@@ -9229,7 +9229,7 @@ void PrimaryLogPG::submit_log_entries(
 
   boost::intrusive_ptr<RepGather> repop;
   boost::optional<std::function<void(void)> > on_complete;
-  if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
+  if (get_osdmap()->require_osd_release >= CEPH_RELEASE_JEWEL) {
     repop = new_repop(
       version,
       r,
@@ -9255,7 +9255,7 @@ void PrimaryLogPG::submit_log_entries(
        if (peer == pg_whoami) continue;
        assert(peer_missing.count(peer));
        assert(peer_info.count(peer));
-       if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
+       if (get_osdmap()->require_osd_release >= CEPH_RELEASE_JEWEL) {
          assert(repop);
          MOSDPGUpdateLogMissing *m = new MOSDPGUpdateLogMissing(
            entries,
@@ -9279,7 +9279,7 @@ void PrimaryLogPG::submit_log_entries(
            peer.osd, m, get_osdmap()->get_epoch());
        }
       }
-      if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
+      if (get_osdmap()->require_osd_release >= CEPH_RELEASE_JEWEL) {
        ceph_tid_t rep_tid = repop->rep_tid;
        waiting_on.insert(pg_whoami);
        log_entry_update_waiting_on.insert(
@@ -10316,7 +10316,7 @@ void PrimaryLogPG::do_update_log_missing(OpRequestRef &op)
       unlock();
     });
 
-  if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
+  if (get_osdmap()->require_osd_release >= CEPH_RELEASE_KRAKEN) {
     t.register_on_commit(complete);
   } else {
     /* Hack to work around the fact that ReplicatedBackend sends
@@ -10432,7 +10432,7 @@ void PrimaryLogPG::mark_all_unfound_lost(
       {
        pg_log_entry_t e(pg_log_entry_t::LOST_DELETE, oid, v, m->second.need,
                         0, osd_reqid_t(), mtime, 0);
-       if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
+       if (get_osdmap()->require_osd_release >= CEPH_RELEASE_JEWEL) {
          if (pool.info.require_rollback()) {
            e.mod_desc.try_rmobject(v.version);
          } else {
@@ -13500,7 +13500,7 @@ void PrimaryLogPG::scrub_snapshot_metadata(
          head_error.set_head_mismatch();
        }
 
-       if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+       if (get_osdmap()->require_osd_release >= CEPH_RELEASE_LUMINOUS) {
          if (soid.is_snapdir()) {
            dout(10) << " will move snapset to head from " << soid << dendl;
            snapset_to_repair[soid.get_head()] = *snapset;
index d51506df2ef2059faff3cb68385c479744fe323e..e092ca630108ae1e7d252e340dd13e263e914205 100644 (file)
@@ -513,7 +513,7 @@ void ReplicatedBackend::submit_transaction(
   generate_transaction(
     t,
     coll,
-    !get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN),
+    (get_osdmap()->require_osd_release < CEPH_RELEASE_KRAKEN),
     log_entries,
     &op_t,
     &added,
index bfdc4ba945dc51578fa9d678ebc34c6f8ede50da..49b4e2fa9ab30868a18297dbeb200f8bf531b277 100644 (file)
@@ -3363,7 +3363,7 @@ void PastIntervals::update_type(bool ec_pool, bool compact)
 
 void PastIntervals::update_type_from_map(bool ec_pool, const OSDMap &osdmap)
 {
-  update_type(ec_pool, osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS));
+  update_type(ec_pool, osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS);
 }
 
 bool PastIntervals::is_new_interval(