]> 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>
Wed, 19 Nov 2014 03:04:21 +0000 (19:04 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/tools/ceph_objectstore_tool.cc

index de2b5d895acd953c4379b142afabf1674cc87cca..2d3d229b274633de795b3a818b0329b5a45363a4 100644 (file)
@@ -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()
 {