]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-objectstore-tool: Dump hinfo when available for objects
authorDavid Zafman <dzafman@redhat.com>
Fri, 23 Nov 2018 07:52:56 +0000 (23:52 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 11 Dec 2018 16:01:52 +0000 (08:01 -0800)
Fixes: http://tracker.ceph.com/issues/37597
Signed-off-by: David Zafman <dzafman@redhat.com>
src/tools/ceph_objectstore_tool.cc

index 1c947cf9ddbafda8bec7ffe9304002bb8e55b4de..ecbf06456687b4c06c403d9b260853c7684a4f86 100644 (file)
@@ -35,6 +35,7 @@
 #include "osd/PGLog.h"
 #include "osd/OSD.h"
 #include "osd/PG.h"
+#include "osd/ECUtil.h"
 
 #include "json_spirit/json_spirit_value.h"
 #include "json_spirit/json_spirit_reader.h"
@@ -2417,6 +2418,22 @@ int print_obj_info(ObjectStore *store, coll_t coll, ghobject_t &ghobj, Formatter
       formatter->close_section();
     }
   }
+  bufferlist hattr;
+  gr = store->getattr(ch, ghobj, ECUtil::get_hinfo_key(), hattr);
+  if (gr == 0) {
+    ECUtil::HashInfo hinfo;
+    auto hp = hattr.cbegin();
+    try {
+      decode(hinfo, hp);
+      formatter->open_object_section("hinfo");
+      hinfo.dump(formatter);
+      formatter->close_section();
+    } catch (...) {
+      r = -EINVAL;
+      cerr << "Error decoding hinfo on : " << make_pair(coll, ghobj) << ", "
+           << cpp_strerror(r) << std::endl;
+    }
+  }
   formatter->close_section();
   formatter->flush(cout);
   cout << std::endl;