]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_mon: all output after initial fork go to dout/derr
authorJoao Eduardo Luis <joao.luis@inktank.com>
Fri, 14 Mar 2014 17:44:06 +0000 (17:44 +0000)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Fri, 14 Mar 2014 17:44:06 +0000 (17:44 +0000)
We were doing it in some cases, and not doing in some other cases.  Just
do it throughout.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/ceph_mon.cc

index d5e154ca8581ce9d7903adc42f682233fc106df5..0c63e68f7416ccccc021af67e3eecb89295b07b1 100644 (file)
@@ -435,7 +435,7 @@ int main(int argc, const char **argv)
       prefork.exit(1);
     }
     if (ret > 0) {
-      cout << "converting monitor store, please do not interrupt..." << std::endl;
+      dout(0) << "converting monitor store, please do not interrupt..." << dendl;
       int r = converter.convert();
       if (r) {
        derr << "failed to convert monitor store: " << cpp_strerror(r) << dendl;
@@ -452,18 +452,18 @@ int main(int argc, const char **argv)
   bufferlist magicbl;
   err = store->get(Monitor::MONITOR_NAME, "magic", magicbl);
   if (!magicbl.length()) {
-    cerr << "unable to read magic from mon data.. did you run mkcephfs?" << std::endl;
+    derr << "unable to read magic from mon data.. did you run mkcephfs?" << dendl;
     prefork.exit(1);
   }
   string magic(magicbl.c_str(), magicbl.length()-1);  // ignore trailing \n
   if (strcmp(magic.c_str(), CEPH_MON_ONDISK_MAGIC)) {
-    cerr << "mon fs magic '" << magic << "' != current '" << CEPH_MON_ONDISK_MAGIC << "'" << std::endl;
+    derr << "mon fs magic '" << magic << "' != current '" << CEPH_MON_ONDISK_MAGIC << "'" << dendl;
     prefork.exit(1);
   }
 
   err = Monitor::check_features(store);
   if (err < 0) {
-    cerr << "error checking features: " << cpp_strerror(err) << std::endl;
+    derr << "error checking features: " << cpp_strerror(err) << dendl;
     prefork.exit(1);
   }
 
@@ -473,21 +473,23 @@ int main(int argc, const char **argv)
     std::string error;
     int r = bl.read_file(inject_monmap.c_str(), &error);
     if (r) {
-      cerr << "unable to read monmap from " << inject_monmap << ": "
-          << error << std::endl;
+      derr << "unable to read monmap from " << inject_monmap << ": "
+          << error << dendl;
       prefork.exit(1);
     }
 
     // get next version
     version_t v = store->get("monmap", "last_committed");
-    cout << "last committed monmap epoch is " << v << ", injected map will be " << (v+1) << std::endl;
+    dout(0) << "last committed monmap epoch is " << v << ", injected map will be " << (v+1)
+            << dendl;
     v++;
 
     // set the version
     MonMap tmp;
     tmp.decode(bl);
     if (tmp.get_epoch() != v) {
-      cout << "changing monmap epoch from " << tmp.get_epoch() << " to " << v << std::endl;
+      dout(0) << "changing monmap epoch from " << tmp.get_epoch()
+           << " to " << v << dendl;
       tmp.set_epoch(v);
     }
     bufferlist mapbl;
@@ -503,7 +505,7 @@ int main(int argc, const char **argv)
     t.put("monmap", "last_committed", v);
     store->apply_transaction(t);
 
-    cout << "done." << std::endl;
+    dout(0) << "done." << dendl;
     prefork.exit(0);
   }
 
@@ -549,9 +551,9 @@ int main(int argc, const char **argv)
     if (g_conf->get_val_from_conf_file(my_sections, "mon addr",
                                       mon_addr_str, true) == 0) {
       if (conf_addr.parse(mon_addr_str.c_str()) && (ipaddr != conf_addr)) {
-       cerr << "WARNING: 'mon addr' config option " << conf_addr
+       derr << "WARNING: 'mon addr' config option " << conf_addr
             << " does not match monmap file" << std::endl
-            << "         continuing with monmap configuration" << std::endl;
+            << "         continuing with monmap configuration" << dendl;
       }
     }
   } else {
@@ -568,7 +570,8 @@ int main(int argc, const char **argv)
       MonMap tmpmap;
       int err = tmpmap.build_initial(g_ceph_context, cerr);
       if (err < 0) {
-       cerr << argv[0] << ": error generating initial monmap: " << cpp_strerror(err) << std::endl;
+       derr << argv[0] << ": error generating initial monmap: "
+             << cpp_strerror(err) << dendl;
        usage();
        prefork.exit(1);
       }
@@ -626,11 +629,11 @@ int main(int argc, const char **argv)
   messenger->set_policy_throttlers(entity_name_t::TYPE_OSD, daemon_throttler, NULL);
   messenger->set_policy_throttlers(entity_name_t::TYPE_MDS, daemon_throttler, NULL);
 
-  cout << "starting " << g_conf->name << " rank " << rank
+  dout(0) << "starting " << g_conf->name << " rank " << rank
        << " at " << ipaddr
        << " mon_data " << g_conf->mon_data
        << " fsid " << monmap.get_fsid()
-       << std::endl;
+       << dendl;
 
   err = messenger->bind(ipaddr);
   if (err < 0)