From 758a7ceaf7b06c3fa13dc778750641253ec2d20e Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 9 Sep 2014 16:43:15 +0100 Subject: [PATCH] mds: include client metadata in `session ls` Signed-off-by: John Spray --- src/mds/MDS.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index d797b3df2ae57..88607d7ca525b 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -244,16 +244,24 @@ bool MDS::asok_command(string command, cmdmap_t& cmdmap, string format, continue; } + Session *s = p->second; + f->open_object_section("session"); f->dump_int("id", p->first.num()); - f->dump_int("num_leases", p->second->leases.size()); - f->dump_int("num_caps", p->second->caps.size()); + f->dump_int("num_leases", s->leases.size()); + f->dump_int("num_caps", s->caps.size()); - f->dump_string("state", p->second->get_state_name()); - f->dump_int("replay_requests", is_clientreplay() ? p->second->get_request_count() : 0); + f->dump_string("state", s->get_state_name()); + f->dump_int("replay_requests", is_clientreplay() ? s->get_request_count() : 0); f->dump_bool("reconnecting", server->waiting_for_reconnect(p->first.num())); - f->dump_stream("inst") << p->second->info.inst; + f->dump_stream("inst") << s->info.inst; + f->open_object_section("client_metadata"); + for (map::const_iterator i = s->info.client_metadata.begin(); + i != s->info.client_metadata.end(); ++i) { + f->dump_string(i->first.c_str(), i->second); + } + f->close_section(); // client_metadata f->close_section(); //session } f->close_section(); //sessions -- 2.39.5