]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDmap: fix OSDMap::Incremental::dump() for new pool names
authorSage Weil <sage@inktank.com>
Fri, 12 Jul 2013 01:43:24 +0000 (18:43 -0700)
committerSage Weil <sage@inktank.com>
Sun, 14 Jul 2013 04:09:31 +0000 (21:09 -0700)
The name is always present when pools are created, but not when they are
modified.  Also, a name may be present with a new_pools entry if the pool
is just renamed.  Separate it out completely in the dump.

Backport: cuttlefish, bobtail
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 3e4a29111e89588385e63f8d92ce3d67739dd679)

src/osd/OSDMap.cc

index 8e0474eb7818f0e8b5b135026d4dd2654a12b044..065dcccce8cb253dbb40e74f618024bd78ae4255 100644 (file)
@@ -453,11 +453,18 @@ void OSDMap::Incremental::dump(Formatter *f) const
   for (map<int64_t,pg_pool_t>::const_iterator p = new_pools.begin(); p != new_pools.end(); ++p) {
     f->open_object_section("pool");
     f->dump_int("pool", p->first);
-    f->dump_string("name", new_pool_names.find(p->first)->second);
     p->second.dump(f);
     f->close_section();
   }
   f->close_section();
+  f->open_array_section("new_pool_names");
+  for (map<int64_t,string>::const_iterator p = new_pool_names.begin(); p != new_pool_names.end(); ++p) {
+    f->open_object_section("pool_name");
+    f->dump_int("pool", p->first);
+    f->dump_string("name", p->second);
+    f->close_section();
+  }
+  f->close_section();
   f->open_array_section("old_pools");
   for (set<int64_t>::const_iterator p = old_pools.begin(); p != old_pools.end(); ++p)
     f->dump_int("pool", *p);