]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MgrMonitor: print MgrMap to log on each change
authorSage Weil <sage@redhat.com>
Thu, 30 Mar 2017 16:06:43 +0000 (12:06 -0400)
committerSage Weil <sage@redhat.com>
Thu, 30 Mar 2017 21:57:35 +0000 (17:57 -0400)
The other services do this.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MgrMap.h
src/mon/MgrMonitor.cc
src/mon/MgrMonitor.h

index d9c8e4eb8ce4199f6bda95867c33e51830a4acb2..167573da47460b6d739b4424ad37d31fd33a63cc 100644 (file)
@@ -138,6 +138,12 @@ public:
       }
     }
   }
+
+  friend ostream& operator<<(ostream& out, const MgrMap& m) {
+    ostringstream ss;
+    m.print_summary(nullptr, &ss);
+    return out << ss.str();
+  }
 };
 
 WRITE_CLASS_ENCODER_FEATURES(MgrMap)
index fcef7ca50f814e59640bafed57783f5d99d77f17..e9276cf36404461702587a75712e55cdee7a8f44 100644 (file)
@@ -68,6 +68,7 @@ void MgrMonitor::create_pending()
 
 void MgrMonitor::encode_pending(MonitorDBStore::TransactionRef t)
 {
+  dout(10) << __func__ << " " << pending_map << dendl;
   bufferlist bl;
   pending_map.encode(bl, 0);
   put_version(t, pending_map.epoch, bl);
@@ -304,6 +305,12 @@ void MgrMonitor::send_digests()
   mon->timer.add_event_after(g_conf->mon_mgr_digest_period, digest_callback);
 }
 
+void MgrMonitor::on_active()
+{
+  if (mon->is_leader())
+    mon->clog->info() << "mgrmap e" << map.epoch << ": " << map;
+}
+
 void MgrMonitor::get_health(
   list<pair<health_status_t,string> >& summary,
   list<pair<health_status_t,string> > *detail,
index b82b6df58a25a63f63e9038278590fd096f4392e..a582d95b1f6324c1b9f4283676d8990e9e950ada 100644 (file)
@@ -72,10 +72,10 @@ public:
   void check_subs();
   void send_digests();
 
+  void on_active() override;
   void get_health(list<pair<health_status_t,string> >& summary,
                  list<pair<health_status_t,string> > *detail,
                  CephContext *cct) const override;
-
   void tick() override;
 
   void print_summary(Formatter *f, std::ostream *ss) const;