From: Sage Weil Date: Mon, 23 Apr 2018 17:42:15 +0000 (-0500) Subject: mon/OSDMonitor: move OSDMap feature calculation into OSDMap helper X-Git-Tag: v12.2.6~44^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=686b054f48c50859bd5e8bad93007bf9d7d7899c;p=ceph.git mon/OSDMonitor: move OSDMap feature calculation into OSDMap helper The OSDMap knows what features it needs to encode itself "properly"; move that into a helper. Signed-off-by: Sage Weil (cherry picked from commit 0ceb5c0f3694725c7043ea99b077816da2ca44a7) Conflicts: src/mon/OSDMonitor.cc trival confilict src/osd/OSDMap.cc drop mimic related code --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 1fa4cadd1ce..40896d33611 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1329,7 +1329,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) osdmap.maybe_remove_pg_upmaps(cct, osdmap, &pending_inc); // features for osdmap and its incremental - uint64_t features = mon->get_quorum_con_features(); + uint64_t features; // encode full map and determine its crc OSDMap tmp; @@ -1338,23 +1338,12 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) tmp.apply_incremental(pending_inc); // determine appropriate features - if (tmp.require_osd_release < CEPH_RELEASE_LUMINOUS) { - dout(10) << __func__ << " encoding without feature SERVER_LUMINOUS" - << dendl; - features &= ~CEPH_FEATURE_SERVER_LUMINOUS; - } - 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; - } + features = tmp.get_encoding_features(); dout(10) << __func__ << " encoding full map with " << features << dendl; + // the features should be a subset of the mon quorum's features! + assert((features & ~mon->get_quorum_con_features()) == 0); + bufferlist fullbl; ::encode(tmp, fullbl, features | CEPH_FEATURE_RESERVED); pending_inc.full_crc = tmp.get_crc(); diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index f7af73b57d3..7be597439c1 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -236,6 +236,8 @@ int OSDMap::Incremental::propagate_snaps_to_tiers(CephContext *cct, return 0; } +// ---------------------------------- +// OSDMap bool OSDMap::subtree_is_down(int id, set *down_cache) const { @@ -2349,6 +2351,24 @@ bool OSDMap::primary_changed( return false; // same primary (tho replicas may have changed) } +uint64_t OSDMap::get_encoding_features() const +{ + uint64_t f = SIGNIFICANT_FEATURES; + if (require_osd_release < CEPH_RELEASE_LUMINOUS) { + f &= ~(CEPH_FEATURE_SERVER_LUMINOUS | + CEPH_FEATURE_CRUSH_CHOOSE_ARGS); + } + if (require_osd_release < CEPH_RELEASE_KRAKEN) { + f &= ~(CEPH_FEATURE_SERVER_KRAKEN | + CEPH_FEATURE_MSG_ADDR2 | + CEPH_FEATURE_CRUSH_TUNABLES5); + } + if (require_osd_release < CEPH_RELEASE_JEWEL) { + f &= ~(CEPH_FEATURE_SERVER_JEWEL | + CEPH_FEATURE_NEW_OSDOP_ENCODING); + } + return f; +} // serialize, unserialize void OSDMap::encode_client_old(bufferlist& bl) const diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 9adc911e7d4..5d59754cef9 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -610,6 +610,8 @@ public: return SIGNIFICANT_FEATURES & features; } + uint64_t get_encoding_features() const; + void deepish_copy_from(const OSDMap& o) { *this = o; primary_temp.reset(new mempool::osdmap::map(*o.primary_temp));