]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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)
committerAshish Singh <assingh@redhat.com>
Fri, 4 Jan 2019 08:01:06 +0000 (13:31 +0530)
Fixes: http://tracker.ceph.com/issues/37597
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit fd19c47a450bee80e6fafb1a47e13054d1fa0fab)

Conflicts:
src/tools/ceph_objectstore_tool.cc
Changed 'cbegin()' to 'begin()' and changed 'ch' to
'coll' as connection handler was introduced in mimic.

src/tools/ceph_objectstore_tool.cc

index 2d47a47cfd6e78ef549250d073a40374473bd384..208db5351f5792fbd81163cccfc0c46031e40822 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"
@@ -2399,6 +2400,22 @@ int print_obj_info(ObjectStore *store, coll_t coll, ghobject_t &ghobj, Formatter
       formatter->close_section();
     }
   }
+  bufferlist hattr;
+  gr = store->getattr(coll, ghobj, ECUtil::get_hinfo_key(), hattr);
+  if (gr == 0) {
+    ECUtil::HashInfo hinfo;
+    auto hp = hattr.begin();
+    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;