Make the output of cmon on stderr a little bit less verbose.
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
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)
{
// 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");
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);
}
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()
<< " already started that will now die! call messenger.start() sooner."
<< dendl;
}
- dout(1) << "messenger.start daemonizing" << dendl;
if (1) {
daemon(1, 0);
::chdir(g_conf.chdir);
}
dout_handle_daemonize();
+ dout(1) << "messenger.start daemonized" << dendl;
}
// go!