]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: move to 'osdmap' mempool
authorSage Weil <sage@redhat.com>
Mon, 24 Apr 2017 22:54:16 +0000 (18:54 -0400)
committerSage Weil <sage@redhat.com>
Tue, 25 Apr 2017 13:11:50 +0000 (09:11 -0400)
We leave a few things out:

- strings (to annoying, and they are small)
- erasure code profiles (ditto)

Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/DaemonServer.cc
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/mon/PGMap.cc
src/mon/PGMap.h
src/osd/OSDMap.cc
src/osd/OSDMap.h
src/test/osd/TestOSDMap.cc

index f54d903dbd214c6260e4367269dc32f9bff85022..fe0729d7484e936f983459c01928e2e20ac9481f 100644 (file)
@@ -572,7 +572,7 @@ bool DaemonServer::handle_command(MCommand *m)
     string no_increasing;
     cmd_getval(g_ceph_context, cmdmap, "no_increasing", no_increasing);
     string out_str;
-    map<int32_t, uint32_t> new_weights;
+    mempool::osdmap::map<int32_t, uint32_t> new_weights;
     r = cluster_state.with_pgmap([&](const PGMap& pgmap) {
        return cluster_state.with_osdmap([&](const OSDMap& osdmap) {
            return reweight::by_utilization(osdmap, pgmap,
index a31d7bce40a0d6b7a20eb59eb18cd0d4bbc0387f..128b3fde0938b0687fcd5ec22b9aaf0b120cfc0c 100644 (file)
@@ -1093,7 +1093,9 @@ void OSDMonitor::prime_pg_temp(
   {
     Mutex::Locker l(prime_pg_temp_lock);
     // do not touch a mapping if a change is pending
-    pending_inc.new_pg_temp.emplace(pgid, acting);
+    pending_inc.new_pg_temp.emplace(
+      pgid,
+      mempool::osdmap::vector<int>(acting.begin(), acting.end()));
   }
 }
 
@@ -2631,7 +2633,7 @@ bool OSDMonitor::preprocess_pgtemp(MonOpRequestRef op)
 {
   MOSDPGTemp *m = static_cast<MOSDPGTemp*>(op->get_req());
   dout(10) << "preprocess_pgtemp " << *m << dendl;
-  vector<int> empty;
+  mempool::osdmap::vector<int> empty;
   int from = m->get_orig_source().num();
   size_t ignore_cnt = 0;
 
@@ -2695,9 +2697,10 @@ bool OSDMonitor::preprocess_pgtemp(MonOpRequestRef op)
     // change?
     //  NOTE: we assume that this will clear pg_primary, so consider
     //        an existing pg_primary field to imply a change
-    if (p->second.size() && (osdmap.pg_temp->count(p->first) == 0 ||
-                            (*osdmap.pg_temp)[p->first] != p->second ||
-                            osdmap.primary_temp->count(p->first)))
+    if (p->second.size() &&
+       (osdmap.pg_temp->count(p->first) == 0 ||
+        !vectors_equal((*osdmap.pg_temp)[p->first], p->second) ||
+        osdmap.primary_temp->count(p->first)))
       return false;
   }
 
@@ -2744,7 +2747,8 @@ bool OSDMonitor::prepare_pgtemp(MonOpRequestRef op)
                << ": pool has been removed" << dendl;
       continue;
     }
-    pending_inc.new_pg_temp[p->first] = p->second;
+    pending_inc.new_pg_temp[p->first] =
+      mempool::osdmap::vector<int>(p->second.begin(), p->second.end());
 
     // unconditionally clear pg_primary (until this message can encode
     // a change for that, too.. at which point we need to also fix
@@ -3136,10 +3140,11 @@ void OSDMonitor::check_pg_creates_sub(Subscription *sub)
   }
 }
 
-void OSDMonitor::scan_for_creating_pgs(const map<int64_t,pg_pool_t>& pools,
-                                      const set<int64_t>& removed_pools,
-                                      utime_t modified,
-                                      creating_pgs_t* creating_pgs) const
+void OSDMonitor::scan_for_creating_pgs(
+  const mempool::osdmap::map<int64_t,pg_pool_t>& pools,
+  const mempool::osdmap::set<int64_t>& removed_pools,
+  utime_t modified,
+  creating_pgs_t* creating_pgs) const
 {
   for (auto& p : pools) {
     int64_t poolid = p.first;
@@ -5243,9 +5248,10 @@ bool OSDMonitor::validate_crush_against_features(const CrushWrapper *newcrush,
   return false;
 }
 
-bool OSDMonitor::erasure_code_profile_in_use(const map<int64_t, pg_pool_t> &pools,
-                                            const string &profile,
-                                            ostream *ss)
+bool OSDMonitor::erasure_code_profile_in_use(
+  const mempool::osdmap::map<int64_t, pg_pool_t> &pools,
+  const string &profile,
+  ostream *ss)
 {
   bool found = false;
   for (map<int64_t, pg_pool_t>::const_iterator p = pools.begin();
@@ -7500,7 +7506,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
       new_pg_temp.push_back(osd);
     }
 
-    pending_inc.new_pg_temp[pgid] = new_pg_temp;
+    pending_inc.new_pg_temp[pgid] = mempool::osdmap::vector<int>(
+      new_pg_temp.begin(), new_pg_temp.end());
     ss << "set " << pgid << " pg_temp mapping to " << new_pg_temp;
     goto update;
   } else if (prefix == "osd primary-temp") {
@@ -7602,7 +7609,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
       new_pg_upmap.push_back(osd);
     }
 
-    pending_inc.new_pg_upmap[pgid] = new_pg_upmap;
+    pending_inc.new_pg_upmap[pgid] = mempool::osdmap::vector<int32_t>(
+      new_pg_upmap.begin(), new_pg_upmap.end());
     ss << "set " << pgid << " pg_upmap mapping to " << new_pg_upmap;
     goto update;
   } else if (prefix == "osd rm-pg-upmap") {
@@ -7718,7 +7726,9 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
       new_pg_upmap_items.push_back(make_pair(from, to));
     }
 
-    pending_inc.new_pg_upmap_items[pgid] = new_pg_upmap_items;
+    pending_inc.new_pg_upmap_items[pgid] =
+      mempool::osdmap::vector<pair<int32_t,int32_t>>(
+      new_pg_upmap_items.begin(), new_pg_upmap_items.end());
     ss << "set " << pgid << " pg_upmap_items mapping to " << new_pg_upmap_items;
     goto update;
   } else if (prefix == "osd rm-pg-upmap-items") {
@@ -7849,7 +7859,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
          << cmd_vartype_stringify(cmdmap["weights"]) << "'";
       goto reply;
     }
-    pending_inc.new_weight = std::move(weights);
+    pending_inc.new_weight.insert(weights.begin(), weights.end());
     wait_for_finished_proposal(
        op,
        new Monitor::C_Command(mon, op, 0, rs, rdata, get_last_committed() + 1));
@@ -8913,7 +8923,7 @@ done:
     string no_increasing;
     cmd_getval(g_ceph_context, cmdmap, "no_increasing", no_increasing);
     string out_str;
-    map<int32_t, uint32_t> new_weights;
+    mempool::osdmap::map<int32_t, uint32_t> new_weights;
     err = reweight::by_utilization(osdmap,
                                   mon->pgmon()->pg_map,
                                   oload,
index 4674241592f7715c03c4d4ca32ff2d9038110725..c6735e365682715c262d674c3265b8a02679144e 100644 (file)
@@ -331,9 +331,10 @@ private:
                                 const string &ruleset_name,
                                 int *crush_ruleset,
                                 ostream *ss);
-  bool erasure_code_profile_in_use(const map<int64_t, pg_pool_t> &pools,
-                                  const string &profile,
-                                  ostream *ss);
+  bool erasure_code_profile_in_use(
+    const mempool::osdmap::map<int64_t, pg_pool_t> &pools,
+    const string &profile,
+    ostream *ss);
   int parse_erasure_code_profile(const vector<string> &erasure_code_profile,
                                 map<string,string> *erasure_code_profile_map,
                                 ostream *ss);
@@ -452,10 +453,11 @@ private:
 
   creating_pgs_t update_pending_pgs(const OSDMap::Incremental& inc);
   void trim_creating_pgs(creating_pgs_t *creating_pgs, const PGMap& pgm);
-  void scan_for_creating_pgs(const std::map<int64_t,pg_pool_t>& pools,
-                            const std::set<int64_t>& removed_pools,
-                            utime_t modified,
-                            creating_pgs_t* creating_pgs) const;
+  void scan_for_creating_pgs(
+    const mempool::osdmap::map<int64_t,pg_pool_t>& pools,
+    const mempool::osdmap::set<int64_t>& removed_pools,
+    utime_t modified,
+    creating_pgs_t* creating_pgs) const;
   pair<int32_t, pg_t> get_parent_pg(pg_t pgid) const;
   void update_creating_pgs();
   void check_pg_creates_subs();
index 9e5524865f37eeb62e0b67056df2f9dfe137f554..57d95805a514466197fe941406ac0e1462dbef73 100644 (file)
@@ -2860,7 +2860,7 @@ int reweight::by_utilization(
     int max_osds,
     bool by_pg, const set<int64_t> *pools,
     bool no_increasing,
-    map<int32_t, uint32_t>* new_weights,
+    mempool::osdmap::map<int32_t, uint32_t>* new_weights,
     std::stringstream *ss,
     std::string *out_str,
     Formatter *f)
index 05ccea3f03fc69f9454c8199af3e31a2538d8975..506f86d9300c301c265dd0ea13ca9816be0dc96c 100644 (file)
@@ -453,7 +453,7 @@ namespace reweight {
                     int max_osds,
                     bool by_pg, const set<int64_t> *pools,
                     bool no_increasing,
-                    map<int32_t, uint32_t>* new_weights,
+                    mempool::osdmap::map<int32_t, uint32_t>* new_weights,
                     std::stringstream *ss,
                     std::string *out_str,
                     Formatter *f);
index 1c70174b0c0f6097e31331753b31e2db214af47b..10223af137e36db055fdba88a09a1c67dc19f7f7 100644 (file)
@@ -1355,7 +1355,7 @@ void OSDMap::clean_temps(CephContext *cct,
     vector<int> raw_up;
     int primary;
     tmpmap.pg_to_raw_up(pg.first, &raw_up, &primary);
-    if (raw_up == pg.second) {
+    if (vectors_equal(raw_up, pg.second)) {
       ldout(cct, 10) << __func__ << "  removing pg_temp " << pg.first << " "
                     << pg.second << " that matches raw_up mapping" << dendl;
       if (osdmap.pg_temp->count(pg.first))
@@ -1714,7 +1714,7 @@ void OSDMap::_apply_remap(const pg_pool_t& pi, pg_t raw_pg, vector<int> *raw) co
        return;
       }
     }
-    *raw = p->second;
+    *raw = vector<int>(p->second.begin(), p->second.end());
     return;
   }
 
@@ -2364,7 +2364,7 @@ void OSDMap::decode(bufferlist::iterator& bl)
     ::decode(*pg_temp, bl);
     ::decode(*primary_temp, bl);
     if (struct_v >= 2) {
-      osd_primary_affinity.reset(new vector<__u32>);
+      osd_primary_affinity.reset(new mempool::osdmap::vector<__u32>);
       ::decode(*osd_primary_affinity, bl);
       if (osd_primary_affinity->empty())
        osd_primary_affinity.reset();
@@ -2461,8 +2461,9 @@ void OSDMap::post_decode()
   _calc_up_osd_features();
 }
 
-void OSDMap::dump_erasure_code_profiles(const map<string,map<string,string> > &profiles,
-                                       Formatter *f)
+void OSDMap::dump_erasure_code_profiles(
+  const mempool::osdmap::map<string,map<string,string>>& profiles,
+  Formatter *f)
 {
   f->open_object_section("erasure_code_profiles");
   for (const auto &profile : profiles) {
@@ -3321,7 +3322,7 @@ int OSDMap::clean_pg_upmaps(
     vector<int> raw;
     int primary;
     pg_to_raw_osds(p.first, &raw, &primary);
-    if (raw == p.second) {
+    if (vectors_equal(raw, p.second)) {
       ldout(cct, 10) << " removing redundant pg_upmap " << p.first << " "
                     << p.second << dendl;
       pending_inc->old_pg_upmap.insert(p.first);
@@ -3332,7 +3333,7 @@ int OSDMap::clean_pg_upmaps(
     vector<int> raw;
     int primary;
     pg_to_raw_osds(p.first, &raw, &primary);
-    vector<pair<int,int>> newmap;
+    mempool::osdmap::vector<pair<int,int>> newmap;
     for (auto& q : p.second) {
       if (std::find(raw.begin(), raw.end(), q.first) != raw.end()) {
        newmap.push_back(q);
@@ -3530,7 +3531,7 @@ int OSDMap::calc_pg_upmaps(
          continue;
        }
        assert(orig != out);
-       vector<pair<int,int>>& rmi = tmp.pg_upmap_items[pg];
+       auto& rmi = tmp.pg_upmap_items[pg];
        for (unsigned i = 0; i < out.size(); ++i) {
          if (orig[i] != out[i]) {
            rmi.push_back(make_pair(orig[i], out[i]));
index 6151d09493c235ada34cd1d1661b005f8fbe7633..691a413b60e35bbae2bb8cf6a5677431281eb594 100644 (file)
@@ -40,6 +40,17 @@ using namespace std;
 class CephContext;
 class CrushWrapper;
 
+// FIXME C++11 does not have std::equal for two differently-typed containers.
+// use this until we move to c++14
+template<typename A, typename B>
+bool vectors_equal(A a, B b)
+{
+  return
+    a.size() == b.size() &&
+    (a.empty() ||
+     memcmp((char*)&a[0], (char*)&b[0], sizeof(a[0]) * a.size()) == 0);
+}
+
 
 /*
  * we track up to two intervals during which the osd was alive and
@@ -125,32 +136,32 @@ public:
 
     // incremental
     int32_t new_max_osd;
-    map<int64_t,pg_pool_t> new_pools;
-    map<int64_t,string> new_pool_names;
-    set<int64_t> old_pools;
-    map<string,map<string,string> > new_erasure_code_profiles;
-    vector<string> old_erasure_code_profiles;
-    map<int32_t,entity_addr_t> new_up_client;
-    map<int32_t,entity_addr_t> new_up_cluster;
-    map<int32_t,uint8_t> new_state;             // XORed onto previous state.
-    map<int32_t,uint32_t> new_weight;
-    map<pg_t,vector<int32_t> > new_pg_temp;     // [] to remove
-    map<pg_t, int32_t> new_primary_temp;            // [-1] to remove
-    map<int32_t,uint32_t> new_primary_affinity;
-    map<int32_t,epoch_t> new_up_thru;
-    map<int32_t,pair<epoch_t,epoch_t> > new_last_clean_interval;
-    map<int32_t,epoch_t> new_lost;
-    map<int32_t,uuid_d> new_uuid;
-    map<int32_t,osd_xinfo_t> new_xinfo;
-
-    map<entity_addr_t,utime_t> new_blacklist;
-    vector<entity_addr_t> old_blacklist;
-    map<int32_t, entity_addr_t> new_hb_back_up;
-    map<int32_t, entity_addr_t> new_hb_front_up;
-
-    map<pg_t,vector<int32_t>> new_pg_upmap;
-    map<pg_t,vector<pair<int32_t,int32_t>>> new_pg_upmap_items;
-    set<pg_t> old_pg_upmap, old_pg_upmap_items;
+    mempool::osdmap::map<int64_t,pg_pool_t> new_pools;
+    mempool::osdmap::map<int64_t,string> new_pool_names;
+    mempool::osdmap::set<int64_t> old_pools;
+    mempool::osdmap::map<string,map<string,string> > new_erasure_code_profiles;
+    mempool::osdmap::vector<string> old_erasure_code_profiles;
+    mempool::osdmap::map<int32_t,entity_addr_t> new_up_client;
+    mempool::osdmap::map<int32_t,entity_addr_t> new_up_cluster;
+    mempool::osdmap::map<int32_t,uint8_t> new_state;             // XORed onto previous state.
+    mempool::osdmap::map<int32_t,uint32_t> new_weight;
+    mempool::osdmap::map<pg_t,mempool::osdmap::vector<int32_t> > new_pg_temp;     // [] to remove
+    mempool::osdmap::map<pg_t, int32_t> new_primary_temp;            // [-1] to remove
+    mempool::osdmap::map<int32_t,uint32_t> new_primary_affinity;
+    mempool::osdmap::map<int32_t,epoch_t> new_up_thru;
+    mempool::osdmap::map<int32_t,pair<epoch_t,epoch_t> > new_last_clean_interval;
+    mempool::osdmap::map<int32_t,epoch_t> new_lost;
+    mempool::osdmap::map<int32_t,uuid_d> new_uuid;
+    mempool::osdmap::map<int32_t,osd_xinfo_t> new_xinfo;
+
+    mempool::osdmap::map<entity_addr_t,utime_t> new_blacklist;
+    mempool::osdmap::vector<entity_addr_t> old_blacklist;
+    mempool::osdmap::map<int32_t, entity_addr_t> new_hb_back_up;
+    mempool::osdmap::map<int32_t, entity_addr_t> new_hb_front_up;
+
+    mempool::osdmap::map<pg_t,mempool::osdmap::vector<int32_t>> new_pg_upmap;
+    mempool::osdmap::map<pg_t,mempool::osdmap::vector<pair<int32_t,int32_t>>> new_pg_upmap_items;
+    mempool::osdmap::set<pg_t> old_pg_upmap, old_pg_upmap_items;
 
     string cluster_snapshot;
 
@@ -198,7 +209,7 @@ public:
       return i != new_erasure_code_profiles.end();
     }
     void set_erasure_code_profile(const string &name,
-                                 const map<string,string> &profile) {
+                                 const map<string,string>profile) {
       new_erasure_code_profiles[name] = profile;
     }
 
@@ -222,33 +233,33 @@ private:
   vector<uint8_t> osd_state;
 
   struct addrs_s {
-    vector<ceph::shared_ptr<entity_addr_t> > client_addr;
-    vector<ceph::shared_ptr<entity_addr_t> > cluster_addr;
-    vector<ceph::shared_ptr<entity_addr_t> > hb_back_addr;
-    vector<ceph::shared_ptr<entity_addr_t> > hb_front_addr;
+    mempool::osdmap::vector<ceph::shared_ptr<entity_addr_t> > client_addr;
+    mempool::osdmap::vector<ceph::shared_ptr<entity_addr_t> > cluster_addr;
+    mempool::osdmap::vector<ceph::shared_ptr<entity_addr_t> > hb_back_addr;
+    mempool::osdmap::vector<ceph::shared_ptr<entity_addr_t> > hb_front_addr;
     entity_addr_t blank;
   };
   ceph::shared_ptr<addrs_s> osd_addrs;
 
-  vector<__u32>   osd_weight;   // 16.16 fixed point, 0x10000 = "in", 0 = "out"
-  vector<osd_info_t> osd_info;
-  ceph::shared_ptr< map<pg_t,vector<int32_t> > > pg_temp;  // temp pg mapping (e.g. while we rebuild)
-  ceph::shared_ptr< map<pg_t,int32_t > > primary_temp;  // temp primary mapping (e.g. while we rebuild)
-  ceph::shared_ptr< vector<__u32> > osd_primary_affinity; ///< 16.16 fixed point, 0x10000 = baseline
+  mempool::osdmap::vector<__u32>   osd_weight;   // 16.16 fixed point, 0x10000 = "in", 0 = "out"
+  mempool::osdmap::vector<osd_info_t> osd_info;
+  ceph::shared_ptr< mempool::osdmap::map<pg_t,mempool::osdmap::vector<int32_t> > > pg_temp;  // temp pg mapping (e.g. while we rebuild)
+  ceph::shared_ptr< mempool::osdmap::map<pg_t,int32_t > > primary_temp;  // temp primary mapping (e.g. while we rebuild)
+  ceph::shared_ptr< mempool::osdmap::vector<__u32> > osd_primary_affinity; ///< 16.16 fixed point, 0x10000 = baseline
 
   // remap (post-CRUSH, pre-up)
-  map<pg_t,vector<int32_t>> pg_upmap; ///< remap pg
-  map<pg_t,vector<pair<int32_t,int32_t>>> pg_upmap_items; ///< remap osds in up set
+  mempool::osdmap::map<pg_t,mempool::osdmap::vector<int32_t>> pg_upmap; ///< remap pg
+  mempool::osdmap::map<pg_t,mempool::osdmap::vector<pair<int32_t,int32_t>>> pg_upmap_items; ///< remap osds in up set
 
-  map<int64_t,pg_pool_t> pools;
-  map<int64_t,string> pool_name;
-  map<string,map<string,string> > erasure_code_profiles;
-  map<string,int64_t> name_pool;
+  mempool::osdmap::map<int64_t,pg_pool_t> pools;
+  mempool::osdmap::map<int64_t,string> pool_name;
+  mempool::osdmap::map<string,map<string,string> > erasure_code_profiles;
+  mempool::osdmap::map<string,int64_t> name_pool;
 
-  ceph::shared_ptr< vector<uuid_d> > osd_uuid;
-  vector<osd_xinfo_t> osd_xinfo;
+  ceph::shared_ptr< mempool::osdmap::vector<uuid_d> > osd_uuid;
+  mempool::osdmap::vector<osd_xinfo_t> osd_xinfo;
 
-  ceph::unordered_map<entity_addr_t,utime_t> blacklist;
+  mempool::osdmap::unordered_map<entity_addr_t,utime_t> blacklist;
 
   epoch_t cluster_snapshot_epoch;
   string cluster_snapshot;
@@ -278,9 +289,9 @@ private:
             num_osd(0), num_up_osd(0), num_in_osd(0),
             max_osd(0),
             osd_addrs(std::make_shared<addrs_s>()),
-            pg_temp(std::make_shared<map<pg_t,vector<int32_t>>>()),
-            primary_temp(std::make_shared<map<pg_t,int32_t>>()),
-            osd_uuid(std::make_shared<vector<uuid_d>>()),
+            pg_temp(std::make_shared<mempool::osdmap::map<pg_t,mempool::osdmap::vector<int32_t>>>()),
+            primary_temp(std::make_shared<mempool::osdmap::map<pg_t,int32_t>>()),
+            osd_uuid(std::make_shared<mempool::osdmap::vector<uuid_d>>()),
             cluster_snapshot_epoch(0),
             new_blacklist_entries(false),
             cached_up_osd_features(0),
@@ -297,12 +308,12 @@ public:
 
   void deepish_copy_from(const OSDMap& o) {
     *this = o;
-    primary_temp.reset(new map<pg_t,int32_t>(*o.primary_temp));
-    pg_temp.reset(new map<pg_t,vector<int32_t> >(*o.pg_temp));
-    osd_uuid.reset(new vector<uuid_d>(*o.osd_uuid));
+    primary_temp.reset(new mempool::osdmap::map<pg_t,int32_t>(*o.primary_temp));
+    pg_temp.reset(new mempool::osdmap::map<pg_t,mempool::osdmap::vector<int32_t> >(*o.pg_temp));
+    osd_uuid.reset(new mempool::osdmap::vector<uuid_d>(*o.osd_uuid));
 
     if (o.osd_primary_affinity)
-      osd_primary_affinity.reset(new vector<__u32>(*o.osd_primary_affinity));
+      osd_primary_affinity.reset(new mempool::osdmap::vector<__u32>(*o.osd_primary_affinity));
 
     // NOTE: this still references shared entity_addr_t's.
     osd_addrs.reset(new addrs_s(*o.osd_addrs));
@@ -343,8 +354,11 @@ public:
     return nearfull_ratio;
   }
   void count_full_nearfull_osds(int *full, int *backfill, int *nearfull) const;
-  void get_full_osd_util(const ceph::unordered_map<int32_t,osd_stat_t> &osd_stat,
-                         map<int, float> *full, map<int, float> *backfill, map<int, float> *nearfull) const;
+  void get_full_osd_util(
+    const ceph::unordered_map<int32_t,osd_stat_t> &osd_stat,
+    map<int, float> *full,
+    map<int, float> *backfill,
+    map<int, float> *nearfull) const;
 
   /***** cluster state *****/
   /* osds */
@@ -408,8 +422,9 @@ public:
   void set_primary_affinity(int o, int w) {
     assert(o < max_osd);
     if (!osd_primary_affinity)
-      osd_primary_affinity.reset(new vector<__u32>(max_osd,
-                                                  CEPH_OSD_DEFAULT_PRIMARY_AFFINITY));
+      osd_primary_affinity.reset(
+       new mempool::osdmap::vector<__u32>(
+         max_osd, CEPH_OSD_DEFAULT_PRIMARY_AFFINITY));
     (*osd_primary_affinity)[o] = w;
   }
   unsigned get_primary_affinity(int o) const {
@@ -430,10 +445,11 @@ public:
                                       map<string,string> &profile_map,
                                       ostream *ss);
   void set_erasure_code_profile(const string &name,
-                               const map<string,string> &profile) {
+                               const map<string,string>profile) {
     erasure_code_profiles[name] = profile;
   }
-  const map<string,string> &get_erasure_code_profile(const string &name) const {
+  const map<string,string> &get_erasure_code_profile(
+    const string &name) const {
     static map<string,string> empty;
     auto i = erasure_code_profiles.find(name);
     if (i == erasure_code_profiles.end())
@@ -441,7 +457,7 @@ public:
     else
       return i->second;
   }
-  const map<string,map<string,string> > &get_erasure_code_profiles() const {
+  const mempool::osdmap::map<string,map<string,string> > &get_erasure_code_profiles() const {
     return erasure_code_profiles;
   }
 
@@ -763,10 +779,10 @@ public:
   int64_t get_pool_max() const {
     return pool_max;
   }
-  const map<int64_t,pg_pool_t>& get_pools() const {
+  const mempool::osdmap::map<int64_t,pg_pool_t>& get_pools() const {
     return pools;
   }
-  map<int64_t,pg_pool_t>& get_pools() {
+  mempool::osdmap::map<int64_t,pg_pool_t>& get_pools() {
     return pools;
   }
   const string& get_pool_name(int64_t p) const {
@@ -933,8 +949,9 @@ public:
 
   string get_flag_string() const;
   static string get_flag_string(unsigned flags);
-  static void dump_erasure_code_profiles(const map<string,map<string,string> > &profiles,
-                                        Formatter *f);
+  static void dump_erasure_code_profiles(
+    const mempool::osdmap::map<string,map<string,string> > &profiles,
+    Formatter *f);
   void dump(Formatter *f) const;
   static void generate_test_instances(list<OSDMap*>& o);
   bool check_new_blacklist_entries() const { return new_blacklist_entries; }
index a8692d6043d91ea0fd2199c5991052907ce2689e..e833ab2e4ff5a8e0c528c33828d543112590d08d 100644 (file)
@@ -235,7 +235,8 @@ TEST_F(OSDMapTest, PGTempRespected) {
 
   // apply pg_temp to osdmap
   OSDMap::Incremental pgtemp_map(osdmap.get_epoch() + 1);
-  pgtemp_map.new_pg_temp[pgid] = new_acting_osds;
+  pgtemp_map.new_pg_temp[pgid] = mempool::osdmap::vector<int>(
+    new_acting_osds.begin(), new_acting_osds.end());
   osdmap.apply_incremental(pgtemp_map);
 
   osdmap.pg_to_up_acting_osds(pgid, &up_osds, &up_primary,
@@ -276,7 +277,8 @@ TEST_F(OSDMapTest, CleanTemps) {
     int up_primary, acting_primary;
     osdmap.pg_to_up_acting_osds(pga, &up_osds, &up_primary,
                                &acting_osds, &acting_primary);
-    pgtemp_map.new_pg_temp[pga] = up_osds;
+    pgtemp_map.new_pg_temp[pga] = mempool::osdmap::vector<int>(
+      up_osds.begin(), up_osds.end());
     pgtemp_map.new_primary_temp[pga] = up_primary;
   }
   pg_t pgb = osdmap.raw_pg_to_pg(pg_t(1, 0));
@@ -285,7 +287,8 @@ TEST_F(OSDMapTest, CleanTemps) {
     int up_primary, acting_primary;
     osdmap.pg_to_up_acting_osds(pgb, &up_osds, &up_primary,
                                &acting_osds, &acting_primary);
-    pending_inc.new_pg_temp[pgb] = up_osds;
+    pending_inc.new_pg_temp[pgb] = mempool::osdmap::vector<int>(
+      up_osds.begin(), up_osds.end());
     pending_inc.new_primary_temp[pgb] = up_primary;
   }
 
@@ -334,7 +337,8 @@ TEST_F(OSDMapTest, KeepsNecessaryTemps) {
   if (i == (int)get_num_osds())
     FAIL() << "did not find unused OSD for temp mapping";
 
-  pgtemp_map.new_pg_temp[pgid] = up_osds;
+  pgtemp_map.new_pg_temp[pgid] = mempool::osdmap::vector<int>(
+    up_osds.begin(), up_osds.end());
   pgtemp_map.new_primary_temp[pgid] = up_osds[1];
   osdmap.apply_incremental(pgtemp_map);