]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: HealthMonitor -> OldHealthMonitor
authorSage Weil <sage@redhat.com>
Mon, 12 Jun 2017 21:44:57 +0000 (17:44 -0400)
committerSage Weil <sage@redhat.com>
Wed, 12 Jul 2017 16:51:30 +0000 (12:51 -0400)
This will go away post-luminous.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/CMakeLists.txt
src/mon/HealthMonitor.cc [deleted file]
src/mon/HealthMonitor.h [deleted file]
src/mon/Monitor.cc
src/mon/OldHealthMonitor.cc [new file with mode: 0644]
src/mon/OldHealthMonitor.h [new file with mode: 0644]

index 9e40ef58863caa0f70df56e073dc45587cae4723..1ba6802e120639adb852e33e3b33740b4eec826f 100644 (file)
@@ -15,7 +15,7 @@ set(lib_mon_srcs
   LogMonitor.cc
   AuthMonitor.cc
   Elector.cc
-  HealthMonitor.cc
+  OldHealthMonitor.cc
   DataHealthService.cc
   PGMonitor.cc
   PGMap.cc
diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc
deleted file mode 100644 (file)
index 2b022b4..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2013 Inktank, Inc
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-
-#include <sstream>
-#include <stdlib.h>
-#include <limits.h>
-
-// #include <boost/intrusive_ptr.hpp>
-// Because intusive_ptr clobbers our assert...
-#include "include/assert.h"
-
-#include "mon/Monitor.h"
-#include "mon/HealthService.h"
-#include "mon/HealthMonitor.h"
-#include "mon/DataHealthService.h"
-
-#include "messages/MMonHealth.h"
-#include "common/Formatter.h"
-// #include "common/config.h"
-
-#define dout_subsys ceph_subsys_mon
-#undef dout_prefix
-#define dout_prefix _prefix(_dout, mon, this)
-static ostream& _prefix(std::ostream *_dout, const Monitor *mon,
-                        const HealthMonitor *hmon) {
-  return *_dout << "mon." << mon->name << "@" << mon->rank
-               << "(" << mon->get_state_name() << ")." << hmon->get_name()
-                << "(" << hmon->get_epoch() << ") ";
-}
-
-void HealthMonitor::init()
-{
-  dout(10) << __func__ << dendl;
-  assert(services.empty());
-  services[HealthService::SERVICE_HEALTH_DATA] = new DataHealthService(mon);
-
-  for (map<int,HealthService*>::iterator it = services.begin();
-       it != services.end();
-       ++it) {
-    it->second->init();
-  }
-}
-
-bool HealthMonitor::service_dispatch(MonOpRequestRef op)
-{
-  assert(op->get_req()->get_type() == MSG_MON_HEALTH);
-  MMonHealth *hm = static_cast<MMonHealth*>(op->get_req());
-  int service_type = hm->get_service_type();
-  if (services.count(service_type) == 0) {
-    dout(1) << __func__ << " service type " << service_type
-            << " not registered -- drop message!" << dendl;
-    return false;
-  }
-  return services[service_type]->service_dispatch(op);
-}
-
-void HealthMonitor::start_epoch() {
-  epoch_t epoch = get_epoch();
-  for (map<int,HealthService*>::iterator it = services.begin();
-       it != services.end(); ++it) {
-    it->second->start(epoch);
-  }
-}
-
-void HealthMonitor::finish_epoch() {
-  generic_dout(20) << "HealthMonitor::finish_epoch()" << dendl;
-  for (map<int,HealthService*>::iterator it = services.begin();
-       it != services.end(); ++it) {
-    assert(it->second != NULL);
-    it->second->finish();
-  }
-}
-
-void HealthMonitor::service_shutdown()
-{
-  dout(0) << "HealthMonitor::service_shutdown "
-          << services.size() << " services" << dendl;
-  for (map<int,HealthService*>::iterator it = services.begin();
-      it != services.end();
-       ++it) {
-    it->second->shutdown();
-    delete it->second;
-  }
-  services.clear();
-}
-
-void HealthMonitor::get_health(
-  list<pair<health_status_t,string> >& summary,
-  list<pair<health_status_t,string> > *detail)
-{
-  for (map<int,HealthService*>::iterator it = services.begin();
-       it != services.end();
-       ++it) {
-    it->second->get_health(summary, detail);
-  }
-}
-
diff --git a/src/mon/HealthMonitor.h b/src/mon/HealthMonitor.h
deleted file mode 100644 (file)
index 66e14d6..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2013 Inktank, Inc
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-#ifndef CEPH_HEALTH_MONITOR_H
-#define CEPH_HEALTH_MONITOR_H
-
-#include "mon/QuorumService.h"
-
-//forward declaration
-namespace ceph { class Formatter; }
-class HealthService;
-
-class HealthMonitor : public QuorumService
-{
-  map<int,HealthService*> services;
-
-protected:
-  void service_shutdown() override;
-
-public:
-  HealthMonitor(Monitor *m) : QuorumService(m) { }
-  ~HealthMonitor() override {
-    assert(services.empty());
-  }
-
-
-  /**
-   * @defgroup HealthMonitor_Inherited_h Inherited abstract methods
-   * @{
-   */
-  void init() override;
-  void get_health(list<pair<health_status_t,string> >& summary,
-                 list<pair<health_status_t,string> > *detail) override;
-  bool service_dispatch(MonOpRequestRef op) override;
-
-  void start_epoch() override;
-
-  void finish_epoch() override;
-
-  void cleanup() override { }
-  void service_tick() override { }
-
-  int get_type() override {
-    return QuorumService::SERVICE_HEALTH;
-  }
-
-  string get_name() const override {
-    return "health";
-  }
-
-  /**
-   * @} // HealthMonitor_Inherited_h
-   */
-};
-
-#endif // CEPH_HEALTH_MONITOR_H
index cad12467ad4eb780c8a1cd9721cc58177fa75fa2..acb50bc508125c45be8163adb2091d579a3f52fd 100644 (file)
@@ -77,7 +77,7 @@
 #include "MgrMonitor.h"
 #include "MgrStatMonitor.h"
 #include "mon/QuorumService.h"
-#include "mon/HealthMonitor.h"
+#include "mon/OldHealthMonitor.h"
 #include "mon/ConfigKeyService.h"
 #include "common/config.h"
 #include "common/cmdparse.h"
@@ -205,7 +205,7 @@ Monitor::Monitor(CephContext* cct_, string nm, MonitorDBStore *s,
   paxos_service[PAXOS_MGR] = new MgrMonitor(this, paxos, "mgr");
   paxos_service[PAXOS_MGRSTAT] = new MgrStatMonitor(this, paxos, "mgrstat");
 
-  health_monitor = new HealthMonitor(this);
+  health_monitor = new OldHealthMonitor(this);
   config_key_service = new ConfigKeyService(this, paxos);
 
   mon_caps = new MonCap();
diff --git a/src/mon/OldHealthMonitor.cc b/src/mon/OldHealthMonitor.cc
new file mode 100644 (file)
index 0000000..d7264a7
--- /dev/null
@@ -0,0 +1,107 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2013 Inktank, Inc
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation.  See file COPYING.
+ *
+ */
+
+#include <sstream>
+#include <stdlib.h>
+#include <limits.h>
+
+// #include <boost/intrusive_ptr.hpp>
+// Because intusive_ptr clobbers our assert...
+#include "include/assert.h"
+
+#include "mon/Monitor.h"
+#include "mon/HealthService.h"
+#include "mon/OldHealthMonitor.h"
+#include "mon/DataHealthService.h"
+
+#include "messages/MMonHealth.h"
+#include "common/Formatter.h"
+// #include "common/config.h"
+
+#define dout_subsys ceph_subsys_mon
+#undef dout_prefix
+#define dout_prefix _prefix(_dout, mon, this)
+static ostream& _prefix(std::ostream *_dout, const Monitor *mon,
+                        const OldHealthMonitor *hmon) {
+  return *_dout << "mon." << mon->name << "@" << mon->rank
+               << "(" << mon->get_state_name() << ")." << hmon->get_name()
+                << "(" << hmon->get_epoch() << ") ";
+}
+
+void OldHealthMonitor::init()
+{
+  dout(10) << __func__ << dendl;
+  assert(services.empty());
+  services[HealthService::SERVICE_HEALTH_DATA] = new DataHealthService(mon);
+
+  for (map<int,HealthService*>::iterator it = services.begin();
+       it != services.end();
+       ++it) {
+    it->second->init();
+  }
+}
+
+bool OldHealthMonitor::service_dispatch(MonOpRequestRef op)
+{
+  assert(op->get_req()->get_type() == MSG_MON_HEALTH);
+  MMonHealth *hm = static_cast<MMonHealth*>(op->get_req());
+  int service_type = hm->get_service_type();
+  if (services.count(service_type) == 0) {
+    dout(1) << __func__ << " service type " << service_type
+            << " not registered -- drop message!" << dendl;
+    return false;
+  }
+  return services[service_type]->service_dispatch(op);
+}
+
+void OldHealthMonitor::start_epoch() {
+  epoch_t epoch = get_epoch();
+  for (map<int,HealthService*>::iterator it = services.begin();
+       it != services.end(); ++it) {
+    it->second->start(epoch);
+  }
+}
+
+void OldHealthMonitor::finish_epoch() {
+  generic_dout(20) << "OldHealthMonitor::finish_epoch()" << dendl;
+  for (map<int,HealthService*>::iterator it = services.begin();
+       it != services.end(); ++it) {
+    assert(it->second != NULL);
+    it->second->finish();
+  }
+}
+
+void OldHealthMonitor::service_shutdown()
+{
+  dout(0) << "OldHealthMonitor::service_shutdown "
+          << services.size() << " services" << dendl;
+  for (map<int,HealthService*>::iterator it = services.begin();
+      it != services.end();
+       ++it) {
+    it->second->shutdown();
+    delete it->second;
+  }
+  services.clear();
+}
+
+void OldHealthMonitor::get_health(
+  list<pair<health_status_t,string> >& summary,
+  list<pair<health_status_t,string> > *detail)
+{
+  for (map<int,HealthService*>::iterator it = services.begin();
+       it != services.end();
+       ++it) {
+    it->second->get_health(summary, detail);
+  }
+}
diff --git a/src/mon/OldHealthMonitor.h b/src/mon/OldHealthMonitor.h
new file mode 100644 (file)
index 0000000..f295693
--- /dev/null
@@ -0,0 +1,66 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2013 Inktank, Inc
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation.  See file COPYING.
+ *
+ */
+#ifndef CEPH_MON_OLDHEALTHMONITOR_H
+#define CEPH_MON_OLDHEALTHMONITOR_H
+
+#include "mon/QuorumService.h"
+
+//forward declaration
+namespace ceph { class Formatter; }
+class HealthService;
+
+class OldHealthMonitor : public QuorumService
+{
+  map<int,HealthService*> services;
+
+protected:
+  void service_shutdown() override;
+
+public:
+  OldHealthMonitor(Monitor *m) : QuorumService(m) { }
+  ~OldHealthMonitor() override {
+    assert(services.empty());
+  }
+
+
+  /**
+   * @defgroup OldHealthMonitor_Inherited_h Inherited abstract methods
+   * @{
+   */
+  void init() override;
+  void get_health(list<pair<health_status_t,string> >& summary,
+                 list<pair<health_status_t,string> > *detail) override;
+  bool service_dispatch(MonOpRequestRef op) override;
+
+  void start_epoch() override;
+
+  void finish_epoch() override;
+
+  void cleanup() override { }
+  void service_tick() override { }
+
+  int get_type() override {
+    return QuorumService::SERVICE_HEALTH;
+  }
+
+  string get_name() const override {
+    return "health";
+  }
+
+  /**
+   * @} // OldHealthMonitor_Inherited_h
+   */
+};
+
+#endif