]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: OSDMap: build reverse name->pool map upon decoding 1095/head
authorJoao Eduardo Luis <jecluis@gmail.com>
Thu, 16 Jan 2014 12:51:32 +0000 (12:51 +0000)
committerJoao Eduardo Luis <jecluis@gmail.com>
Thu, 16 Jan 2014 12:51:32 +0000 (12:51 +0000)
Commit 3d7c69fb09 introduced a new OSDMap encoding/decoding scheme.
However, while the classic decoding function still kept building the
reverse name->pool map, the new decoding function did not, causing the
monitor to be unable to map pool names to pool ids.

This patch fixes this, by factoring out the loop responsible for
populating the 'name_pool' map, as well as calling 'calc_num_osds()', to
OSDMap::post_decode() and having this function called from both the
classic and the new decode functions.

Fixes: 7166
Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
src/osd/OSDMap.cc
src/osd/OSDMap.h

index 4e31b193b6de408875295fbd403b444994d6ba5b..488ae6b0f81baf1a77bd324c826a0745d970b463 100644 (file)
@@ -1721,12 +1721,7 @@ void OSDMap::decode_classic(bufferlist::iterator& p)
   else
     osd_addrs->hb_front_addr.resize(osd_addrs->hb_back_addr.size());
 
-  // index pool names
-  name_pool.clear();
-  for (map<int64_t,string>::iterator i = pool_name.begin(); i != pool_name.end(); ++i)
-    name_pool[i->second] = i->first;
-
-  calc_num_osds();
+  post_decode();
 }
 
 void OSDMap::decode(bufferlist::iterator& bl)
@@ -1793,6 +1788,20 @@ void OSDMap::decode(bufferlist::iterator& bl)
   }
 
   DECODE_FINISH(bl); // wrapper
+
+  post_decode();
+}
+
+void OSDMap::post_decode()
+{
+  // index pool names
+  name_pool.clear();
+  for (map<int64_t,string>::iterator i = pool_name.begin();
+       i != pool_name.end(); ++i) {
+    name_pool[i->second] = i->first;
+  }
+
+  calc_num_osds();
 }
 
 void OSDMap::dump_json(ostream& out) const
index 468b45274933d63ff1aba106fbbd5544a2b9abcb..b9690e8186bbdf331579ecaed4a8932dee97dcf7 100644 (file)
@@ -475,6 +475,7 @@ private:
   void encode_client_old(bufferlist& bl) const;
   void encode_classic(bufferlist& bl, uint64_t features) const;
   void decode_classic(bufferlist::iterator& p);
+  void post_decode();
 public:
   void encode(bufferlist& bl, uint64_t features=CEPH_FEATURES_ALL) const;
   void decode(bufferlist& bl);