]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: add --log-early command line option 27388/head
authorSage Weil <sage@redhat.com>
Sun, 7 Apr 2019 18:54:59 +0000 (13:54 -0500)
committerSage Weil <sage@redhat.com>
Mon, 8 Apr 2019 15:20:08 +0000 (10:20 -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>
(cherry picked from commit 933d5084cb66f299a7bf60f0a2a6382c0bd3cb2f)

src/common/config.cc
src/common/config_values.h
src/global/global_init.cc
src/libcephfs.cc
src/librados/RadosClient.cc

index a51f075c837fff3decfd64828a436fed07a2fdcb..b6feaba4b1f177080f1251a742b4d5b13cdeb774 100644 (file)
@@ -572,6 +572,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 fdfff2b16f33eea5872411330d378507b3cf2541..ab52060e462928c25be5abcf9c3e17ee7ac6029a 100644 (file)
@@ -28,6 +28,7 @@ public:
   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();