mon: OSDMonitor: formatter output on 'osd map'

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Dan Mick 2013-07-10 17:26:34 -07:00
parent 17595f3414
commit e75db7138f

View File

@ -2081,16 +2081,32 @@ bool OSDMonitor::preprocess_command(MMonCommand *m)
pg_t mpgid = osdmap.raw_pg_to_pg(pgid); pg_t mpgid = osdmap.raw_pg_to_pg(pgid);
vector<int> up, acting; vector<int> up, acting;
osdmap.pg_to_up_acting_osds(mpgid, up, acting); osdmap.pg_to_up_acting_osds(mpgid, up, acting);
string fullobjname; string fullobjname;
if (!namespacestr.empty()) if (!namespacestr.empty())
fullobjname = namespacestr + string("/") + oid.name; fullobjname = namespacestr + string("/") + oid.name;
else else
fullobjname = oid.name; fullobjname = oid.name;
ds << "osdmap e" << osdmap.get_epoch() if (f) {
<< " pool '" << poolstr << "' (" << pool << ") object '" << fullobjname << "' ->" f->open_object_section("osd_map");
<< " pg " << pgid << " (" << mpgid << ")" f->dump_int("epoch", osdmap.get_epoch());
<< " -> up " << up << " acting " << acting; f->dump_string("pool", poolstr);
rdata.append(ds); f->dump_int("pool_id", pool);
f->dump_stream("objname") << fullobjname;
f->dump_stream("raw_pgid") << pgid;
f->dump_stream("pgid") << mpgid;
f->dump_stream("up") << up;
f->dump_stream("acting") << acting;
f->close_section(); // osd_map
f->flush(rdata);
} else {
ds << "osdmap e" << osdmap.get_epoch()
<< " pool '" << poolstr << "' (" << pool << ")"
<< " object '" << fullobjname << "' ->"
<< " pg " << pgid << " (" << mpgid << ")"
<< " -> up " << up << " acting " << acting;
rdata.append(ds);
}
} else if ((prefix == "osd scrub" || } else if ((prefix == "osd scrub" ||
prefix == "osd deep-scrub" || prefix == "osd deep-scrub" ||
prefix == "osd repair")) { prefix == "osd repair")) {