"name=id,type=CephInt,range=0", \
"find osd <id> in the CRUSH map and show its location", \
"osd", "r", "cli,rest")
+COMMAND("osd metadata " \
+ "name=id,type=CephInt,range=0", \
+ "fetch metadata for osd <id>", \
+ "osd", "r", "cli,rest")
COMMAND("osd map " \
"name=pool,type=CephPoolname " \
"name=object,type=CephObjectname", \
f->close_section();
f->close_section();
f->flush(rdata);
+ } else if (prefix == "osd metadata") {
+ int64_t osd;
+ cmd_getval(g_ceph_context, cmdmap, "id", osd);
+ if (!osdmap.exists(osd)) {
+ ss << "osd." << osd << " does not exist";
+ r = -ENOENT;
+ goto reply;
+ }
+ string format;
+ cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
+ boost::scoped_ptr<Formatter> f(new_formatter(format));
+
+ bufferlist bl;
+ mon->store->get(OSD_METADATA_PREFIX, stringify(osd), bl);
+ map<string,string> m;
+ if (bl.length()) {
+ bufferlist::iterator p = bl.begin();
+ ::decode(m, p);
+ }
+ f->open_object_section("osd_metadata");
+ for (map<string,string>::iterator p = m.begin(); p != m.end(); ++p)
+ f->dump_string(p->first.c_str(), p->second);
+ f->close_section();
+ f->flush(rdata);
} else if (prefix == "osd map") {
string poolstr, objstr, namespacestr;
cmd_getval(g_ceph_context, cmdmap, "pool", poolstr);