]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-osdomap-tool: Add --debug and only show internal logging if enabled
authorDavid Zafman <dzafman@redhat.com>
Thu, 9 Feb 2017 02:56:27 +0000 (18:56 -0800)
committerDavid Zafman <dzafman@redhat.com>
Mon, 27 Mar 2017 15:33:05 +0000 (08:33 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/tools/ceph_osdomap_tool.cc

index 4a97c4dbd02c9d8d0a9aa848853d8780887bcf2c..6f4e6c4139093303bf99422d33474683dc0508cb 100644 (file)
@@ -28,11 +28,13 @@ using namespace std;
 int main(int argc, char **argv) {
   po::options_description desc("Allowed options");
   string store_path, cmd, out_path, oid;
+  bool debug = false;
   desc.add_options()
     ("help", "produce help message")
     ("omap-path", po::value<string>(&store_path),
      "path to mon directory, mandatory (current/omap usually)")
     ("paranoid", "use paranoid checking")
+    ("debug", "Additional debug output from DBObjectMap")
     ("oid", po::value<string>(&oid), "Restrict to this object id when dumping objects")
     ("command", po::value<string>(&cmd),
      "command arg is one of [dump-raw-keys, dump-raw-key-vals, dump-objects, dump-objects-with-keys, check, dump-headers], mandatory")
@@ -65,12 +67,19 @@ int main(int argc, char **argv) {
     ceph_options.push_back(i->c_str());
   }
 
+  if (vm.count("debug")) debug = true;
+
   auto cct = global_init(
     &def_args, ceph_options, CEPH_ENTITY_TYPE_OSD,
-    CODE_ENVIRONMENT_UTILITY, 0);
+    CODE_ENVIRONMENT_UTILITY_NODOUT, 0);
   common_init_finish(g_ceph_context);
   g_ceph_context->_conf->apply_changes(NULL);
   g_conf = g_ceph_context->_conf;
+  if (debug) {
+    g_conf->set_val_or_die("log_to_stderr", "true");
+    g_conf->set_val_or_die("err_to_stderr", "true");
+  }
+  g_conf->apply_changes(NULL);
 
   if (vm.count("help")) {
     std::cerr << desc << std::endl;