From b3021b0d3362000b5938d406ed2e032a8eb38405 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Tue, 18 Nov 2014 11:59:18 -0800 Subject: [PATCH] ceph_objectstore_tool: Add utility routine get_osdmap() Signed-off-by: David Zafman --- src/tools/ceph_objectstore_tool.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index de2b5d895acd9..2d3d229b27463 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -761,6 +761,21 @@ int export_files(ObjectStore *store, coll_t coll) return 0; } +int get_osdmap(ObjectStore *store, epoch_t e, OSDMap &osdmap) +{ + bufferlist bl; + bool found = store->read( + META_COLL, OSD::get_osdmap_pobject_name(e), 0, 0, bl) >= 0; + if (!found) { + cerr << "Can't find OSDMap for pg epoch " << e << std::endl; + return ENOENT; + } + osdmap.decode(bl); + if (debug) + cerr << osdmap << std::endl; + return 0; +} + //Write super_header with its fixed 16 byte length void write_super() { -- 2.39.5