From 06c65988bb0b1d1ec626fe31e9d806a1c4e24b28 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 11 Jul 2013 18:43:24 -0700 Subject: [PATCH] osd/OSDmap: fix OSDMap::Incremental::dump() for new pool names 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 (cherry picked from commit 3e4a29111e89588385e63f8d92ce3d67739dd679) --- src/osd/OSDMap.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 8e0474eb7818f..065dcccce8cb2 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -453,11 +453,18 @@ void OSDMap::Incremental::dump(Formatter *f) const for (map::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::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::const_iterator p = old_pools.begin(); p != old_pools.end(); ++p) f->dump_int("pool", *p); -- 2.39.5