]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Monitor: pass in CephContext explicitly
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 10 Jun 2011 00:56:41 +0000 (17:56 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 10 Jun 2011 00:56:41 +0000 (17:56 -0700)
Sometimes we create a Monitor without a Messenger. So we can't pull the
CephContext out of the Messenger, because it may be NULL. Just specify
it explicitly in the Monitor constructor.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/cmon.cc
src/mon/Monitor.cc
src/mon/Monitor.h

index 0995e7fb2cdbbfb7e9050653ac7a680dc2bbf319..612a65fd0dd63a4b7f4193a4ccf197d597db0e01 100644 (file)
@@ -109,7 +109,7 @@ int main(int argc, const char **argv)
 
     // go
     MonitorStore store(g_conf->mon_data);
-    Monitor mon(g_conf->name.get_id(), &store, 0, &monmap);
+    Monitor mon(&g_ceph_context, g_conf->name.get_id(), &store, 0, &monmap);
     mon.mkfs(osdmapbl);
     cout << argv[0] << ": created monfs at " << g_conf->mon_data 
         << " for " << g_conf->name << std::endl;
@@ -257,7 +257,7 @@ int main(int argc, const char **argv)
   // start monitor
   messenger->register_entity(entity_name_t::MON(rank));
   messenger->set_default_send_priority(CEPH_MSG_PRIO_HIGH);
-  Monitor *mon = new Monitor(g_conf->name.get_id(), &store, messenger, &monmap);
+  Monitor *mon = new Monitor(&g_ceph_context, g_conf->name.get_id(), &store, messenger, &monmap);
 
   common_init_daemonize(&g_ceph_context, 0);
   common_init_finish(&g_ceph_context);
index 1cb4872da7aa2d1e60545f73aac20a14718bcb93..7606defb4fa4c30dadbb0ceea00a5040de6e05b1 100644 (file)
@@ -85,8 +85,8 @@ const CompatSet::Feature ceph_mon_feature_ro_compat[] =
 const CompatSet::Feature ceph_mon_feature_incompat[] =
   { CEPH_MON_FEATURE_INCOMPAT_BASE , CompatSet::Feature(0, "")};
 
-Monitor::Monitor(string nm, MonitorStore *s, Messenger *m, MonMap *map) :
-  Dispatcher(m->cct),
+Monitor::Monitor(CephContext* cct_, string nm, MonitorStore *s, Messenger *m, MonMap *map) :
+  Dispatcher(cct_),
   name(nm),
   rank(-1), 
   messenger(m),
index b792fd6beb114f30720338ec025838f83f9b9c58..e5fa4e71efc043a6fbe01db2576923ee15e35e08 100644 (file)
@@ -215,7 +215,7 @@ public:
   void ms_handle_remote_reset(Connection *con) {}
 
  public:
-  Monitor(string nm, MonitorStore *s, Messenger *m, MonMap *map);
+  Monitor(CephContext *cct_, string nm, MonitorStore *s, Messenger *m, MonMap *map);
   ~Monitor();
 
   void init();