]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: don't let TYPE_CLIENT entities send stats
authorJohn Spray <john.spray@redhat.com>
Thu, 8 Jun 2017 12:43:02 +0000 (08:43 -0400)
committerJohn Spray <john.spray@redhat.com>
Thu, 8 Jun 2017 14:03:55 +0000 (10:03 -0400)
Anyone instantiating librados instances ended up
appearing as a weird entry in DaemonStateIndex.

Come back to this at the point we want e.g. stats
from RGWs or NFS gateways.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/DaemonServer.cc

index faa60a77659ce45d3fd223b4284167a5b1581ba2..baef94b5f6f35eefa1421353cb92333ad0925000 100644 (file)
@@ -271,7 +271,12 @@ bool DaemonServer::handle_open(MMgrOpen *m)
           << m->daemon_name << dendl;
 
   auto configure = new MMgrConfigure();
-  configure->stats_period = g_conf->mgr_stats_period;
+  if (m->get_connection()->get_peer_type() == entity_name_t::TYPE_CLIENT) {
+    // We don't want clients to send us stats
+    configure->stats_period = 0;
+  } else {
+    configure->stats_period = g_conf->mgr_stats_period;
+  }
   m->get_connection()->send_message(configure);
 
   if (daemon_state.exists(key)) {
@@ -292,6 +297,13 @@ bool DaemonServer::handle_report(MMgrReport *m)
   dout(4) << "from " << m->get_connection() << " name "
           << m->daemon_name << dendl;
 
+  if (m->get_connection()->get_peer_type() == entity_name_t::TYPE_CLIENT) {
+    // Clients should not be sending us stats
+    dout(4) << "rejecting report from client " << m->daemon_name << dendl;
+    m->put();
+    return true;
+  }
+
   DaemonStatePtr daemon;
   if (daemon_state.exists(key)) {
     dout(20) << "updating existing DaemonState for " << m->daemon_name << dendl;