]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgrc: enable sending pgstats
authorJohn Spray <john.spray@redhat.com>
Sun, 31 Jul 2016 17:05:53 +0000 (18:05 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 29 Sep 2016 16:27:01 +0000 (17:27 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/MgrClient.cc
src/mgr/MgrClient.h

index 2a85f0df3085df915e99470d3cc1899c100d3512..1cc610c20d24b0fa0bbaabe14a4c5e1403bce2e1 100644 (file)
@@ -23,6 +23,7 @@
 #include "messages/MMgrConfigure.h"
 #include "messages/MCommand.h"
 #include "messages/MCommandReply.h"
+#include "messages/MPGStats.h"
 
 #define dout_subsys ceph_subsys_mgrc
 #undef dout_prefix
@@ -231,6 +232,11 @@ void MgrClient::send_report()
     report_callback = new C_StdFunction([this](){send_report();});
     timer.add_event_after(stats_period, report_callback);
   }
+
+  if (pgstats_cb) {
+    MPGStats *m_stats = pgstats_cb();
+    session->con->send_message(m_stats);
+  }
 }
 
 bool MgrClient::handle_mgr_configure(MMgrConfigure *m)
index 20a3cc8c02d73d0a529524322d62de0dd55b976f..705dea8c4ef310823b58a7c944138f0a2db21a47 100644 (file)
@@ -27,6 +27,7 @@ class MMgrMap;
 class MMgrConfigure;
 class Messenger;
 class MCommandReply;
+class MPGStats;
 
 class MgrSessionState
 {
@@ -67,6 +68,10 @@ protected:
   list<Cond*> waiting_for_session;
   Context *report_callback;
 
+  // If provided, use this to compose an MPGStats to send with
+  // our reports (hook for use by OSD)
+  std::function<MPGStats*()> pgstats_cb;
+
 public:
   MgrClient(CephContext *cct_, Messenger *msgr_);
 
@@ -85,6 +90,11 @@ public:
 
   void send_report();
 
+  void set_pgstats_cb(std::function<MPGStats*()> cb_)
+  {
+    pgstats_cb = cb_;
+  }
+
   int start_command(const vector<string>& cmd, const bufferlist& inbl,
                    bufferlist *outbl, string *outs,
                    Context *onfinish);