]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: operator<< for Session
authorJohn Spray <john.spray@redhat.com>
Mon, 27 Mar 2017 11:33:59 +0000 (12:33 +0100)
committerNathan Cutler <ncutler@suse.com>
Tue, 4 Jul 2017 11:26:16 +0000 (13:26 +0200)
Use this to get a nice human readable name
when available (also including the session id in
parentheses)

Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 0f89787d8312f132ebb621f16c44e950b17a395a)

src/mds/SessionMap.cc
src/mds/SessionMap.h

index e7dd17534ee683bba80b4515792e0d4a8bceeb41..5e91a5a189d1c18b68b0bccbb0962667f2af79f5 100644 (file)
@@ -1034,3 +1034,13 @@ bool SessionFilter::match(
   return true;
 }
 
+std::ostream& operator<<(std::ostream &out, const Session &s)
+{
+ if (s.get_human_name() == stringify(s.info.inst.name.num())) {
+   out << s.get_human_name();
+ } else {
+   out << s.get_human_name() << " (" << std::dec << s.info.inst.name.num() << ")";
+ }
+ return out;
+}
+
index d395571a21c7857c569f837a633a4a188ea722a0..6a0cc9b21ba08dda6ec090cb70bcb0d6839240dd 100644 (file)
@@ -665,5 +665,7 @@ public:
                      MDSGatherBuilder *gather_bld);
 };
 
+std::ostream& operator<<(std::ostream &out, const Session &s);
+
 
 #endif