From 1a5cc32f0a3bf5ef06642402e930e3786700ab7d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 25 Jan 2017 18:40:45 -0500 Subject: [PATCH] osd/OSDMap: reflect REQUIRE_*_OSDS flag in required features Callers should be mindful of the mask output; this isn't necessary an exhaustive list of features that e.g. a kraken OSD would/should have--just certain interesting ones. Signed-off-by: Sage Weil --- src/osd/OSDMap.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index b7685f3d12fa8..8fd5332861013 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1042,7 +1042,7 @@ uint64_t OSDMap::get_features(int entity_type, uint64_t *pmask) const features |= CEPH_FEATURE_CRUSH_TUNABLES5; mask |= CEPH_FEATURES_CRUSH; - for (map::const_iterator p = pools.begin(); p != pools.end(); ++p) { + for (auto p = pools.begin(); p != pools.end(); ++p) { if (p->second.has_flag(pg_pool_t::FLAG_HASHPSPOOL)) { features |= CEPH_FEATURE_OSDHASHPSPOOL; } @@ -1067,7 +1067,7 @@ uint64_t OSDMap::get_features(int entity_type, uint64_t *pmask) const } } if (entity_type == CEPH_ENTITY_TYPE_OSD) { - for (map >::const_iterator p = erasure_code_profiles.begin(); + for (auto p = erasure_code_profiles.begin(); p != erasure_code_profiles.end(); ++p) { const map &profile = p->second; @@ -1094,6 +1094,19 @@ uint64_t OSDMap::get_features(int entity_type, uint64_t *pmask) const } mask |= CEPH_FEATURE_OSD_PRIMARY_AFFINITY; + const uint64_t jewel_features = CEPH_FEATURE_SERVER_JEWEL; + if (test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) { + features |= jewel_features; + } + mask |= jewel_features; + + const uint64_t kraken_features = CEPH_FEATURE_SERVER_KRAKEN + | CEPH_FEATURE_MSG_ADDR2; + if (test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) { + features |= kraken_features; + } + mask |= kraken_features; + if (pmask) *pmask = mask; return features; -- 2.39.5