]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: add --log-early command line option 27419/head
authorSage Weil <sage@redhat.com>
Sun, 7 Apr 2019 18:54:59 +0000 (13:54 -0500)
committerSage Weil <sage@redhat.com>
Sun, 7 Apr 2019 18:58:43 +0000 (13:58 -0500)
Sometime it is important and useful to see the logs from the bootstrap
phase where we are getting the initial configs from the monitors.  Add
a command-line option --log-early to do that.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config.cc
src/common/config_values.h
src/global/global_init.cc
src/libcephfs.cc
src/librados/RadosClient.cc

index d1895a21c0b735d7b467835f0cae41068095e80d..48b71dad1e2c996adc58ea687091e43b80033bd1 100644 (file)
@@ -570,6 +570,9 @@ int md_config_t::parse_argv(ConfigValues& values,
     else if (ceph_argparse_flag(args, i, "--no-mon-config", (char*)NULL)) {
       values.no_mon_config = true;
     }
+    else if (ceph_argparse_flag(args, i, "--log-early", (char*)NULL)) {
+      values.log_early = true;
+    }
     else if (ceph_argparse_flag(args, i, "--mon-config", (char*)NULL)) {
       values.no_mon_config = false;
     }
index 51f79235332908f67619f1fa28fd8d8019f04cd6..de1661ad10b82186e9bf50df794cc1e7a41dd074 100644 (file)
@@ -28,6 +28,7 @@ public:
   std::string cluster;
   ceph::logging::SubsystemMap subsys;
   bool no_mon_config = false;
+  bool log_early = false;
   // Set of configuration options that have changed since the last
   // apply_changes
   using changed_set_t = std::set<std::string>;
index abce4c05529b8801c6daae1e00268dab2e1c0207..eb8bbfd1a4dbbb68bd9f7785fa3fb90a4fb39fe0 100644 (file)
@@ -142,6 +142,11 @@ void global_pre_init(
   // command line (as passed by caller)
   conf.parse_argv(args);
 
+  if (conf->log_early &&
+      !cct->_log->is_started()) {
+    cct->_log->start();
+  }
+
   if (!conf->no_mon_config) {
     // make sure our mini-session gets legacy values
     conf.apply_changes(nullptr);
@@ -154,7 +159,10 @@ void global_pre_init(
       _exit(1);
     }
   }
-  cct->_log->start();
+  if (!cct->_log->is_started()) {
+    cct->_log->start();
+  }
+
   // do the --show-config[-val], if present in argv
   conf.do_argv_commands();
 
index 6f75b2fff74e2a32fadd5184517d3995683a7d92..0f23fa8e120a8350b2530e3587ea0588caa58cb2 100755 (executable)
@@ -79,6 +79,11 @@ public:
   {
     int ret;
 
+    if (cct->_conf->log_early &&
+       !cct->_log->is_started()) {
+      cct->_log->start();
+    }
+
     {
       MonClient mc_bootstrap(cct);
       ret = mc_bootstrap.get_monmap_and_config();
index 446482e1af231df7bbeec03e3394e78a49414fa0..e232175998779ecc3e708d8a5bbab9c950d719c0 100644 (file)
@@ -238,6 +238,11 @@ int librados::RadosClient::connect()
     return -EISCONN;
   state = CONNECTING;
 
+  if (cct->_conf->log_early &&
+      !cct->_log->is_started()) {
+    cct->_log->start();
+  }
+
   {
     MonClient mc_bootstrap(cct);
     err = mc_bootstrap.get_monmap_and_config();