]> 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)
committerJohn Spray <john.spray@redhat.com>
Thu, 13 Apr 2017 16:32:07 +0000 (12:32 -0400)
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>
src/mds/SessionMap.cc
src/mds/SessionMap.h

index 4dd73cd54725a20a11c0945a9d2ffc92aafd1174..a1ba0db4d80b7037247bad0e66fdf62726a6a40b 100644 (file)
@@ -1041,3 +1041,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 f594a6c6709cd6ffa9bdd622327e554626bebd22..f96d00ab275077c6a07115d01493b51265394356 100644 (file)
@@ -666,5 +666,7 @@ public:
                      MDSGatherBuilder *gather_bld);
 };
 
+std::ostream& operator<<(std::ostream &out, const Session &s);
+
 
 #endif