]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
logger: tweak cmon log output a bit
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 8 Dec 2010 20:58:06 +0000 (12:58 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 8 Dec 2010 21:51:00 +0000 (13:51 -0800)
Make the output of cmon on stderr a little bit less verbose.

Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/common/DoutStreambuf.cc
src/mon/Monitor.cc
src/mon/MonitorStore.cc
src/msg/SimpleMessenger.cc

index 9a7c5b23643c83952b39521eb7af2a927ca3c86a..9fc489002a5b1981dcb95547397d68ff567ecd65 100644 (file)
@@ -80,7 +80,7 @@ static void primitive_log(const std::string &str)
 
 static inline bool prio_is_visible_on_stderr(int prio)
 {
-  return prio <= 9;
+  return prio <= 5;
 }
 
 static inline int dout_prio_to_syslog_prio(int prio)
index c126d60c5985f6244962c335347fb4e31f1a54cf..8f9168cd8088ff8bf3bf4ed92aca3c35f1fe1ac0 100644 (file)
@@ -953,12 +953,12 @@ int Monitor::mkfs(bufferlist& osdmapbl)
 {
   // create it
   int err = store->mkfs();
-  if (err < 0) {
-    char buf[80];
-    cerr << "error " << err << " " << strerror_r(err, buf, sizeof(buf)) << std::endl;
+  if (err) {
+    dout(0) << TEXT_RED << "** ERROR: store->mkfs failed with error code "
+           << err << ". Aborting." << dendl;
     exit(1);
   }
-  
+
   bufferlist magicbl;
   magicbl.append(CEPH_MON_ONDISK_MAGIC);
   magicbl.append("\n");
@@ -966,9 +966,9 @@ int Monitor::mkfs(bufferlist& osdmapbl)
     store->put_bl_ss(magicbl, "magic", 0);
   }
   catch (const MonitorStore::Error &e) {
-    std::cerr << TEXT_RED << "** ERROR: initializing cmon failed: couldn't "
+    dout(0) << TEXT_RED << "** ERROR: initializing cmon failed: couldn't "
               << "initialize the monitor state machine: "
-             << e.what() << TEXT_NORMAL << std::endl;
+             << e.what() << TEXT_NORMAL << dendl;
     exit(1);
   }
 
index d8e6cf4bce62d1d31e1896978e1d1ef97aa46851..7984432c629c1df871bfe961dafc4b8244b11434 100644 (file)
@@ -106,13 +106,20 @@ int MonitorStore::umount()
 
 int MonitorStore::mkfs()
 {
-  dout(1) << "mkfs" << dendl;
-
   char cmd[1024];
-  snprintf(cmd, sizeof(cmd), "test -d %s && /bin/rm -rf %s ; mkdir -p %s", dir.c_str(), dir.c_str(), dir.c_str());
-  dout(1) << cmd << dendl;
-  int r = system(cmd);
-  return r;
+  snprintf(cmd, sizeof(cmd), "test -d %s && /bin/rm -rf %s ; mkdir -p %s",
+          dir.c_str(), dir.c_str(), dir.c_str());
+  dout(6) << "MonitorStore::mkfs: running command '" << cmd << "'" << dendl;
+  int res = system(cmd);
+  int r = WEXITSTATUS(res);
+  if (r) {
+    dout(0) << "FAILED to create monfs at " << dir.c_str() << " for "
+           << g_conf.id << ": cmd '" << cmd << "'" << dendl;
+    return r;
+  }
+
+  dout(0) << "created monfs at " << dir.c_str() << " for " << g_conf.id << dendl;
+  return 0;
 }
 
 void MonitorStore::sync()
index cdc1d28399b460881aa635b15894db681bcde6be..b623585447aff120e7fb048b19020a3afde45a02 100644 (file)
@@ -2376,7 +2376,6 @@ int SimpleMessenger::start(bool nodaemon)
              << " already started that will now die!  call messenger.start() sooner." 
              << dendl;
     }
-    dout(1) << "messenger.start daemonizing" << dendl;
 
     if (1) {
       daemon(1, 0);
@@ -2398,6 +2397,7 @@ int SimpleMessenger::start(bool nodaemon)
       ::chdir(g_conf.chdir);
     }
     dout_handle_daemonize();
+    dout(1) << "messenger.start daemonized" << dendl;
   }
 
   // go!