]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_objectstore_tool: Add utility routine get_osdmap()
authorDavid Zafman <dzafman@redhat.com>
Tue, 18 Nov 2014 19:59:18 +0000 (11:59 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 3 Mar 2015 19:19:13 +0000 (11:19 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit b3021b0d3362000b5938d406ed2e032a8eb38405)

Conflicts:
src/tools/ceph_objectstore_tool.cc

src/tools/ceph_objectstore_tool.cc

index e9a2a628acc28df89cc23243bfe9c82234e8d89d..f0ac03f65ecb894072805cd710a0443de9f0ead5 100644 (file)
@@ -760,6 +760,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(
+      coll_t::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()
 {